You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/08/06 17:56:34 UTC
svn commit: r683307 - in /cxf/trunk:
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Author: dkulp
Date: Wed Aug 6 08:56:33 2008
New Revision: 683307
URL: http://svn.apache.org/viewvc?rev=683307&view=rev
Log:
One more attempt to get the "accepted content types" stuff set on the exchange properly in all cases
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=683307&r1=683306&r2=683307&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java Wed Aug 6 08:56:33 2008
@@ -108,18 +108,17 @@
path = path + "/";
}
- String acceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
- if (acceptTypes == null) {
- acceptTypes = "*/*";
- }
- List<MediaType> acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes);
- message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
-
//1. Matching target resource class
Service service = message.getExchange().get(Service.class);
List<ClassResourceInfo> resources = ((JAXRSServiceImpl)service).getClassResourceInfos();
+ String acceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
+ if (acceptTypes == null) {
+ acceptTypes = "*/*";
+ message.put(Message.ACCEPT_CONTENT_TYPE, acceptTypes);
+ }
+
MultivaluedMap<String, String> values = new MetadataMap<String, String>();
ClassResourceInfo resource = JAXRSUtils.selectResourceClass(resources, path, values);
if (resource == null) {
@@ -128,19 +127,31 @@
BUNDLE,
path);
LOG.severe(errorMsg.toString());
+ acceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
+ List<MediaType> acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes);
+ message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
+
throw new WebApplicationException(404);
}
-
+
+
List<ProviderInfo<RequestHandler>> shs =
ProviderFactory.getInstance().getRequestHandlers();
for (ProviderInfo<RequestHandler> sh : shs) {
Response response = sh.getProvider().handleRequest(message, resource);
if (response != null) {
message.getExchange().put(Response.class, response);
+ acceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
+ List<MediaType> acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes);
+ message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
return;
}
}
+ acceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
+ List<MediaType> acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes);
+ message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
+
message.getExchange().put(ROOT_RESOURCE_CLASS, resource);
LOG.fine("Request path is: " + path);
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=683307&r1=683306&r2=683307&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Wed Aug 6 08:56:33 2008
@@ -41,7 +41,7 @@
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
- launchServer(BookServer.class, true));
+ launchServer(BookServer.class));
}
@Test