You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Felipe Jaekel <fk...@gmail.com> on 2019/06/19 13:29:05 UTC

CXF default exception mapper config

Hi,

I'm working in a REST service that throws WebApplicationExcepion with
custom messages. I need pass the custom exception message to the client,
but it is ignored. After some search, I found that
the WebApplicationExceptionMapper was the responsible for ignoring the
exception message, but it has a parameter addMessageToResponse. Setting it
to true while debugging on Eclipse works as expected. So my question is how
do I set this parameter on TomEE config? The CXF documentation shows how to
do it using Spring, but I'm using pure Java EE.

https://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-CustomizingdefaultWebApplicationExceptionmapper

Thanks

Re: CXF default exception mapper config

Posted by Felipe Jaekel <fk...@gmail.com>.
Thanks for the feedback.

I was able to send the exception message to the client with this tutorial:
http://blog.ignacio.org.mx/posts/jax-rs-exception-handling/

It works even better than the default WebApplicationExceptionMapper as I
don't require additional parsing to get the exception message, but I'm
still curious on how to set the addMessageToResponse property of the
default WebApplicationExceptionMapper without using Spring.

Em seg, 24 de jun de 2019 às 19:08, César Hernández Mendoza <
cesarguate@gmail.com> escreveu:

> I haven't implemented your scenario yet but it seems it's related with the
> configuration on the openejb-jar.xml file [1]:
>
>
> In the openejb-jar.xml put
>
> > <openejb-jar xmlns="openejb.org/openejb-jar/1.1">
> >  <pojo-deployment class-name="jaxrs-application">
> >    <properties>
> >           cxf.jaxrs.providers = namespace.YourCustomExceptionMapper
> >    </properties>
> >  </pojo-deployment>
> > </openejb-jar>
>
>
>
> [1]
>
> https://stackoverflow.com/questions/34234609/how-can-i-enable-my-custom-exceptionmapper-in-tomee
>
>
>
>
>
> El mié., 19 jun. 2019 a las 7:29, Felipe Jaekel (<fk...@gmail.com>)
> escribió:
>
> > Hi,
> >
> > I'm working in a REST service that throws WebApplicationExcepion with
> > custom messages. I need pass the custom exception message to the client,
> > but it is ignored. After some search, I found that
> > the WebApplicationExceptionMapper was the responsible for ignoring the
> > exception message, but it has a parameter addMessageToResponse. Setting
> it
> > to true while debugging on Eclipse works as expected. So my question is
> how
> > do I set this parameter on TomEE config? The CXF documentation shows how
> to
> > do it using Spring, but I'm using pure Java EE.
> >
> >
> >
> https://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-CustomizingdefaultWebApplicationExceptionmapper
> >
> > Thanks
> >
>
>
> --
> Atentamente:
> César Hernández.
>

Re: CXF default exception mapper config

Posted by César Hernández Mendoza <ce...@gmail.com>.
I haven't implemented your scenario yet but it seems it's related with the
configuration on the openejb-jar.xml file [1]:


In the openejb-jar.xml put

> <openejb-jar xmlns="openejb.org/openejb-jar/1.1">
>  <pojo-deployment class-name="jaxrs-application">
>    <properties>
>           cxf.jaxrs.providers = namespace.YourCustomExceptionMapper
>    </properties>
>  </pojo-deployment>
> </openejb-jar>



[1]
https://stackoverflow.com/questions/34234609/how-can-i-enable-my-custom-exceptionmapper-in-tomee





El mié., 19 jun. 2019 a las 7:29, Felipe Jaekel (<fk...@gmail.com>)
escribió:

> Hi,
>
> I'm working in a REST service that throws WebApplicationExcepion with
> custom messages. I need pass the custom exception message to the client,
> but it is ignored. After some search, I found that
> the WebApplicationExceptionMapper was the responsible for ignoring the
> exception message, but it has a parameter addMessageToResponse. Setting it
> to true while debugging on Eclipse works as expected. So my question is how
> do I set this parameter on TomEE config? The CXF documentation shows how to
> do it using Spring, but I'm using pure Java EE.
>
>
> https://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-CustomizingdefaultWebApplicationExceptionmapper
>
> Thanks
>


-- 
Atentamente:
César Hernández.