Hi Peter,
regarding your earlier comment about WAE,

> Not really, the mapper will have a chance to update Response already
> available in the caught WebApplicationException, but eventually it
will
> be up to the providers (MBW) to handle the actual response

The spec [1] says that I should not be able to do this. The
WebApplicationExceptions that is thrown out of
AbstractOAuthServer#reportInvalidRequest contains already an entity
that
must be used.

Interesting. I guess at the moment CXF will let custom
WebApplicationException mappers to modify the original Response
available from WebApplicationException, but it is really up to the
custom mapper if that is to be done or not, definitely not something
that CXF itself will do (ie, it won't modify the custom
WebApplicationException resposne if any).


I'll probably seek some clarifications on this specific point. IMHO the
custom mapper should be able to see all WebApplicationException
instances, even the ones which may already contain Response, example,
for some custom logging purposes

Indeed, the spec text specifically mentions that if WAE Response has an entity - then avoid using the mapper.

We've had the discussion and it is unfortunate this optimization will stay in the spec text because of the BC concerns, however CXF will continue checking the mapper by default (same as RestEasy too) - simply because the properly written mapper will not lose the original response, and very likely, if the mapper has been registered, then the mapper will want to see all WAE exceptions - this won't break the compatibility in any way, because it is just an optimization.

Furthermore, at the moment the spec text is actually buggy because if the application code throws WAE with Response having an entity and this WAE having a cause exception set (obviously for the purpose of the mapper doing something with the cause) then if this optimization is implemented then the cause gets lost for the mapper...

However, those users who actually do mean bypassing the mapper by throwing WAE with Response having a non-empty entity can set "support.wae.spec.optimization" contextual property and instruct the runtime to ignore the mapper

Thanks, Sergey



Thanks, Sergey


Greetings,
Peter

[1]
http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-280003.3.4













--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to