I have been upgrading my application from CXF 2.6 to 3.0 and
encountered a difference to the way JAXRSOutInterceptor selects a
WriterInterceptor to serialize a message based on the Accept header.
It used to be that if you sent a request with an Accept header of
text/html,application/xhtml+xml,application/xml (like a regular
browser does), a WriterInterceptor would be selected based on that [1]
if no Content-Type header was sent along. But in 3.0 this is no longer
the case, only the Content-Type header is used [2]. The problem is
that when I now want to browse my REST service I get a server error
instead of the xml output I was expecting. This is because my browser
does not send a Content-Type header but only an Accept header. Was
this a change required by the spec or is this a bug?
Regards,
Unico
1. http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-bundle/2.6.16/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java#JAXRSOutInterceptor.computeAvailableContentTypes%28org.apache.cxf.message.Message%2Cjavax.ws.rs.core.Response%29
2. http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/3.0.2/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java#213
encountered a difference to the way JAXRSOutInterceptor selects a
WriterInterceptor to serialize a message based on the Accept header.
It used to be that if you sent a request with an Accept header of
text/html,application/xhtml+xml,application/xml (like a regular
browser does), a WriterInterceptor would be selected based on that [1]
if no Content-Type header was sent along. But in 3.0 this is no longer
the case, only the Content-Type header is used [2]. The problem is
that when I now want to browse my REST service I get a server error
instead of the xml output I was expecting. This is because my browser
does not send a Content-Type header but only an Accept header. Was
this a change required by the spec or is this a bug?
Regards,
Unico
1. http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-bundle/2.6.16/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java#JAXRSOutInterceptor.computeAvailableContentTypes%28org.apache.cxf.message.Message%2Cjavax.ws.rs.core.Response%29
2. http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/3.0.2/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java#213