cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1200877 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
Date Fri, 11 Nov 2011 13:35:35 GMT
Author: sergeyb
Date: Fri Nov 11 13:35:35 2011
New Revision: 1200877

URL: http://svn.apache.org/viewvc?rev=1200877&view=rev
Log:
Merged revisions 1200876 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1200876 | sergeyb | 2011-11-11 13:34:09 +0000 (Fri, 11 Nov 2011) | 1 line
  
  [CXF-3902] Adding a query hint when a .wadl suffix is added
........

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/impl/RequestPreprocessor.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 11 13:35:35 2011
@@ -1 +1 @@
-/cxf/trunk:1197048,1198584,1198875,1198884,1199905,1200850
+/cxf/trunk:1197048,1198584,1198875,1198884,1199905,1200850,1200876

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/impl/RequestPreprocessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java?rev=1200877&r1=1200876&r2=1200877&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
Fri Nov 11 13:35:35 2011
@@ -29,6 +29,7 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.ext.RequestHandler;
 import org.apache.cxf.jaxrs.ext.codegen.CodeGeneratorProvider;
 import org.apache.cxf.jaxrs.model.ProviderInfo;
@@ -105,9 +106,21 @@ public class RequestPreprocessor {
     private void handleExtensionMappings(Message m, UriInfo uriInfo) {
         String path = uriInfo.getPath(false);
         for (Map.Entry<?, ?> entry : extensionMappings.entrySet()) {
-            if (path.endsWith("." + entry.getKey().toString())) {
+            String key = entry.getKey().toString();
+            if (path.endsWith("." + key)) {
                 updateAcceptTypeHeader(m, entry.getValue().toString());
-                updatePath(m, path, entry.getKey().toString());
+                updatePath(m, path, key);
+                if ("wadl".equals(key)) {
+                    // the path has been updated and Accept was not necessarily set to 
+                    // WADL type (xml or json or html - other options)
+                    String query = (String)m.get(Message.QUERY_STRING);
+                    if (StringUtils.isEmpty(query)) {
+                        query = WadlGenerator.WADL_QUERY;
+                    } else if (!query.contains(WadlGenerator.WADL_QUERY)) {
+                        query += "&" + WadlGenerator.WADL_QUERY;
+                    }
+                    m.put(Message.QUERY_STRING, query);
+                }
                 break;
             }
         }



Mime
View raw message