<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to customize JAX-RS application exception handling? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319956#M6957</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have configured a simple JAX-RS (not WebEngine as it is for programmatic web services) application as described &lt;A href="http://doc.nuxeo.com/pages/releaseview.action?pageId=17334372"&gt;in the documentation&lt;/A&gt;. I am using the&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Nuxeo-WebModule: org.nuxeo.ecm.webengine.jaxrs.scan.DynamicApplicationFactory
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;line to discover my JAX-RS classes.&lt;/P&gt;
&lt;P&gt;Everything is working as I need, with the small detail that the text/plain error response for WebExceptions that are raised in my JAX-RS classes includes the stack trace. I want them to only include the status line with an empty body.&lt;/P&gt;
&lt;P&gt;What is the correct way to avoid/modify this behavior? I tried putting an ExceptionMapper implementation in my JAX-RS package but the DynamicApplicationFactory does not seem to discover/apply it. It is annotated with @Provider and is in the correct package.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Mar 2014 17:15:17 GMT</pubDate>
    <dc:creator>Steven_Huwig1</dc:creator>
    <dc:date>2014-03-20T17:15:17Z</dc:date>
    <item>
      <title>How to customize JAX-RS application exception handling?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319956#M6957</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have configured a simple JAX-RS (not WebEngine as it is for programmatic web services) application as described &lt;A href="http://doc.nuxeo.com/pages/releaseview.action?pageId=17334372"&gt;in the documentation&lt;/A&gt;. I am using the&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Nuxeo-WebModule: org.nuxeo.ecm.webengine.jaxrs.scan.DynamicApplicationFactory
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;line to discover my JAX-RS classes.&lt;/P&gt;
&lt;P&gt;Everything is working as I need, with the small detail that the text/plain error response for WebExceptions that are raised in my JAX-RS classes includes the stack trace. I want them to only include the status line with an empty body.&lt;/P&gt;
&lt;P&gt;What is the correct way to avoid/modify this behavior? I tried putting an ExceptionMapper implementation in my JAX-RS package but the DynamicApplicationFactory does not seem to discover/apply it. It is annotated with @Provider and is in the correct package.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 17:15:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319956#M6957</guid>
      <dc:creator>Steven_Huwig1</dc:creator>
      <dc:date>2014-03-20T17:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize JAX-RS application exception handling?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319957#M6958</link>
      <description>&lt;P&gt;You can override the handleError() method in your ModuleRoot class. Here is a sample&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Override
public Object handleError(WebApplicationException e) {
    if (e instanceof WebSecurityException) {
        return Response.status(401).entity(
                getTemplate("error/error_401.ftl")).type("text/html").build();
    } else if (e instanceof WebResourceNotFoundException) {
        return Response.status(404).entity(
                getTemplate("error/error_404.ftl")).type("text/html").build();
    } else {
        return super.handleError(e);
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Mar 2014 21:33:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319957#M6958</guid>
      <dc:creator>Damien_Metzler</dc:creator>
      <dc:date>2014-03-20T21:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize JAX-RS application exception handling?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319958#M6959</link>
      <description>&lt;P&gt;Hmm, I don't have a ModuleRoot class. I just have POJOs annotated with the JAX-RS @Path and @Provider, and the &lt;CODE&gt;DynamicApplicationFactory&lt;/CODE&gt; is doing the correct thing with respect to making those available.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 21:50:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319958#M6959</guid>
      <dc:creator>Steven_Huwig1</dc:creator>
      <dc:date>2014-03-20T21:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize JAX-RS application exception handling?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319959#M6960</link>
      <description>&lt;P&gt;Ok, sorry i didn't read well your message and thought you were in a WebEngine app. BTW you can use WebEngine for a "programatic webservice"&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 09:45:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319959#M6960</guid>
      <dc:creator>Damien_Metzler</dc:creator>
      <dc:date>2014-03-21T09:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize JAX-RS application exception handling?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319960#M6961</link>
      <description>&lt;P&gt;Thanks for your help! I did look at the rest of the documentation and decided against using the WebEngine app for the time being, mostly because I really didn't need any of the .ftl or other tools for building more complex systems, since this is only a couple of JSON-driven web services for creating and polling specific documents in the repository.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 15:23:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319960#M6961</guid>
      <dc:creator>Steven_Huwig1</dc:creator>
      <dc:date>2014-03-21T15:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize JAX-RS application exception handling?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319961#M6962</link>
      <description>&lt;P&gt;Any more thoughts on this, Damien? I'm prepared to accept "there isn't a way right now" as an answer for now.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2014 16:20:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-customize-jax-rs-application-exception-handling/m-p/319961#M6962</guid>
      <dc:creator>Steven_Huwig1</dc:creator>
      <dc:date>2014-03-31T16:20:25Z</dc:date>
    </item>
  </channel>
</rss>

