Author: sergeyb
Date: Mon Sep 26 16:34:49 2011
New Revision: 1175943
URL: http://svn.apache.org/viewvc?rev=1175943&view=rev
Log:
Merged revisions 1175939 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1175939 | sergeyb | 2011-09-26 17:29:51 +0100 (Mon, 26 Sep 2011) | 1 line
[CXF-3822] Returning 406 in case of malformed Accept header values
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 26 16:34:49 2011
@@ -1 +1 @@
-/cxf/trunk:1175648,1175747-1175780
+/cxf/trunk:1175648,1175747-1175780,1175939
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=1175943&r1=1175942&r2=1175943&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Mon Sep 26 16:34:49 2011
@@ -131,7 +131,12 @@ public class JAXRSInInterceptor extends
acceptTypes = "*/*";
message.put(Message.ACCEPT_CONTENT_TYPE, acceptTypes);
}
- List<MediaType> acceptContentTypes =
JAXRSUtils.sortMediaTypes(acceptTypes);
+ List<MediaType> acceptContentTypes = null;
+ try {
+ JAXRSUtils.sortMediaTypes(acceptTypes);
+ } catch (IllegalArgumentException ex) {
+ throw new WebApplicationException(406);
+ }
message.getExchange().put(Message.ACCEPT_CONTENT_TYPE,
acceptContentTypes);
MultivaluedMap<String, String> values = new MetadataMap<String,
String>();
Modified:
cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1175943&r1=1175942&r2=1175943&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++
cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Mon Sep 26 16:34:49 2011
@@ -74,6 +74,15 @@ public class JAXRSClientServerBookTest e
}
@Test
+ public void testMalformedAcceptType() {
+ WebClient wc =
+ WebClient.create("http://localhost:" + PORT +
"/bookstore/books/123");
+ wc.accept("application");
+ Response r = wc.get();
+ assertEquals(406, r.getStatus());
+ }
+
+ @Test
public void testProxyWrongAddress() throws Exception {
BookStore store =
JAXRSClientFactory.create("http://localhost:8080/wrongaddress",
BookStore.class);