Hi Sergey,

I had some time to work on these and I still have issues.

For the Language, finally it will be dealt with PathParam 
/path/to/fr_FR/resource , however my LocaleParameterHandler is never called.
InjectionUtils.handleParameter actually look for the first matching constructor 
accepting a string, regardless the provider has a ParameterHandler or not for 
that type. I'm using 2.3.3.


Also for the ExceptionMapper, I cannot access the OperationResourceInfo, the 
code "messageContext.getContextualProperty(OperationResourceInfo.class)" 
actually returns "null" at that time. In the stackframe the code is executing 
from JAXRSUtils.convertFaultToResponse() line 1170.






--  
Brice


Le vendredi 16 décembre 2011 à 11:00, Sergey Beryozkin a écrit :

> Hi Brice
> On 15/12/11 20:04, Brice wrote:
> > Hi Sergey,
> >  
> > I think I hit another issue. I think I got a workaround, yet I'm not sure 
> > it is the best way to do this. But first I'll explain the faced problem :
> >  
> >  
> > I would like to map some exception that might be raised during the message 
> > handling, some raised by the invoker; so an ExceptionMapper could fit in 
> > with some elegance.
> > However, in my Response I would like to get some "technical" data that will 
> > most probably located on an annotation aside the other JAXRS annotations 
> > (@GET, @Path, etc.).
> > But the signature is "Response toResponse(Exception)", so I don't have any 
> > information on the targeted object.
> >  
>  
>  
> You can get CXF-specific MessageContext injected in that mapper and use  
> messageContext.getContextualProperty(OperationResourceInfo.class); and
> OperationResourceInfo.getAnnotatedMethod will return Method with the  
> annotations, you can get to the class-level annotations from there too  
> if needed
>  
>  

> > Also I don't have a Response for this exxcpetion when an exception occur in 
> > "JAXRSInInterceptor.handelMessage(Message)" then I might loose all the 
> > proxies information (thread local is cleared).
>  
> JAXRSInInterceptor checks ExceptionMappers if the exception is thrown  
> during handleMessage(Message)
> >  
> > So the workaround would be to also have a RequestHandler :
> > - the "ExceptionMapper" will create a Response with an incomplete entity
> > - the "RequestHandler" in the "handleResponse(Message, 
> > OperationResourceInfo, Response)" might be able create a new Response from 
> > the original and to "enhance" the entity with the information from the 
> > annotations. The annotation will be accessed through : 
> > "message.getExchange().get(OperationResourceInfo.class).getMethodToInvoke().getAnnotation(SomeCustomAnnotation.class)".
> >  
> > In my opinion this approach looks a wrong, but yet again it is a neophyte 
> > workaround.
>  
> This is possible, why not, but hope the above hint re  
> OperationResourceInfo can make it a bit simpler
>  
> Cheers, Sergey
>  
> > What do you think ? Would it be possible to achieve a better and simpler 
> > solution than having to split this logic ?
> >  
> >  
> >  
> > Thanks again for your time and consideration :)
> >  
> > --
> > Brice
> >  
>  
>  
>  


Reply via email to