cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] [Commented] (CXF-5244) It is not possible to update Content-Type inside JAX-RS 2.0 ContainerRequestFilter
Date Wed, 09 Oct 2013 10:17:50 GMT


Sergey Beryozkin commented on CXF-5244:

Hi, the problem is that PreMatching ContainerRequestFilter operates on modifiable Map of headers,
so if a given filter happens to set "Content-Type" on such a map, then the only way to ensure
this value is picked up is to check the map first.

As it happens CXF Message has Message.PROTOCOL_HEADERS and also a pair of Message.CONTENT_TYPE
& Message.ACCEPT_CONTENT_TYPE properties, the latter is just there to make it simpler
to access the most important headers. 

If you re-set only Message.CONTENT_TYPE but not sync it with Message.PROTOCOL_HEADERS then
it is not obvious what to do now that ContainerRequestFilters have to be supported, what if
the earlier interceptor does only update Message.PROTOCOL_HEADERS but not Message.CONTENT_TYPE

What I mean is that JAXRSInInterceptor can try and sync Message.CONTENT_TYPE/ACCEPT_CONTENT_TYPE
&  Message.PROTOCOL_HEADERS itself to make sure ClientRequestFilter sees the correct values,
but it can not guarantee it will do the sync direction correctly.

If you do the header updates before JAXRSInInterceptor is used, and not using JAX-RS 2.0 filters,
then please  Message.PROTOCOL_HEADERS, a bit more work, yes, but it will be the correct way
to do it.

Do you agree ?


> It is not possible to update Content-Type inside JAX-RS 2.0 ContainerRequestFilter 
> -----------------------------------------------------------------------------------
>                 Key: CXF-5244
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.6
>            Reporter: Dmitry Treskunov
>            Assignee: Sergey Beryozkin
>             Fix For: 2.7.7, 3.0.0
> As I understand, it wasn't possible to update headers inside JAX-RS 2.0 ContainerRequestFilter.

> Is was fixed in this issue
> But now update of Content-Type header inside of @PreMatching filter doesn't affect further
processing - 
> suitable MessageBodyReader is selected using initial Content-Type but not new one.  

This message was sent by Atlassian JIRA

View raw message