On 13/12/12 16:34, Sergey Beryozkin wrote:
On 13/12/12 16:14, Ivan.Latysh wrote:
2.4.10 behavior is more consistent, that is great news, and
Interceptor is
called in both cases.
Cool, thanks for validating this case...I still have not been able to
look into it...
But it is got worse than before, now exception details has been stripped
from the message by the "WebApplicationExceptionMapper" for both cases,
exception thrown of my code and mapping/parsing exceptions.
First the default mapper is there to be overridden (as I said - register
it as jaxrs:provider), and if it were not there then WAEs would escape
completely and the users would be forced to use out fault interceptors
and manually serialize the errors...
Now, please explain what is being stripped by the default mapper, what
were you expecting that is not possible now (with the default mapper) ?
I can see from the code that the following will happen in the default
mapper:
- if the caught WAE's Response contains the entity then this Response
will be used as is.
If not and if the mapper "addMessageToResponse" is set then the extra
info which is created by the default mapper will be reported.
This is optional because one may not always wants to report WAE details,
example, for the security reasons, or simply to get the faster
processing time, or to be very HTTP compliant - many HTTP errors are
actually expected to be returned with no extra payloads
So you can customize it - simple configure the default mapper explicitly
by setting "addMessageToResponse" to true or replace it by registering
your own custom provider
And as before I can not register custom ExceptionMapper for the bus.
That is not possible because ExceptionMappers are not part of the CXF
interceptor model.
I see though the possible limitation with the fact that if you have a
simple exception mapper then you have to manually register which becomes
tedious if you have n+ number of endpoints.
Auto-discovery of the providers (something I've been postponing looking
into) will possibly help in simple cases. Also as I said before, I will
consider adding a utility fault out interceptor which will be able to
map the exceptions even with the help of exception mappers - I'll keep
you up to date on this one
Hmm, I think I'll simply update the exception mapping algo to check the
bus as the last resource, if it is not registered with ProviderFactory
then try bus.get(MyException.class) - if something is there then use
this global mapper - should work...
Sergey
Sergey
War with source code.
https://www.dropbox.com/s/a9nyojse5vy764k/cxf-2.4.10-fault-interceptors.war
Thank you in advance.
--
View this message in context:
http://cxf.547215.n5.nabble.com/Intercepting-exceptions-on-the-server-side-tp5719964p5720221.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com