You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2013/01/25 12:19:12 UTC
[jira] [Commented] (CXF-4782) Cannot easily override the Accept
content type
[ https://issues.apache.org/jira/browse/CXF-4782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13562610#comment-13562610 ]
Sergey Beryozkin commented on CXF-4782:
---------------------------------------
I think you can simply write a basic CXF interceptor which will sit at any stage before or at the one used by JAXRSInInterceptor and replace "_type" with "format" by updating Message.QUERY_STRING on the message; and also update RequestPreprocessor by getting it from the message:
{code:java}
ProviderFactory providerFactory = ProviderFactory.getInstance(message);
RequestPreprocessor rp = providerFactory.getRequestPreprocessor();
{code}
Hope it will do it
> Cannot easily override the Accept content type
> ----------------------------------------------
>
> Key: CXF-4782
> URL: https://issues.apache.org/jira/browse/CXF-4782
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.7.2
> Reporter: Jason Chaffee
>
> I need to add the ability to override the Accept header using a query parameter. I know CXF supports "_type", but there are two problems with the way that is implemented that won't work for us. 1) We need to parameter name to be "format" instead of "_type" and currently this is not configurable. 2) We need to be able to pass in a map of special type that we would like to map. This would added to the SHORTCUTS.
> Since the current RequestPreProcessor doesn't allow for either one of those, I decided to write a JAXRS Filter/RequestHandler. The problem I found is that the JAXRSInInterceptor has already looked up the acceptContentType before my RequestHandler.handleRequest() method is called. Thus, I am unable to override it using this approach.
> Ideally, the fix would be to simply make them configurable in the RequestPreProcessor. However, I am not quite sure how that would be done since this is not a class that is managed/configured in the IoC/DI container.
> Another approach would be to call the RequestHandlers before resolving the acceptContentType.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira