cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1537563 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
Date Thu, 31 Oct 2013 17:29:44 GMT
Author: sergeyb
Date: Thu Oct 31 17:29:44 2013
New Revision: 1537563

URL: http://svn.apache.org/r1537563
Log:
Merged revisions 1537551 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1537551 | sergeyb | 2013-10-31 16:52:45 +0000 (Thu, 31 Oct 2013) | 1 line
  
  RequestDispatcherProvider should add prefix and extensions to the context paths when possible
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1537551

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java?rev=1537563&r1=1537562&r2=1537563&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
Thu Oct 31 17:29:44 2013
@@ -88,6 +88,8 @@ public class RequestDispatcherProvider e
     private boolean saveParametersAsAttributes;
     private boolean logRedirects;
     private boolean strictPathCheck;
+    private String locationPrefix;
+    private String resourceExtension;
     
     private MessageContext mc; 
 
@@ -115,7 +117,9 @@ public class RequestDispatcherProvider e
         if (simpleName.length() > 1) {
             sb.append(simpleName.substring(1));
         }
-        return DEFAULT_LOCATION_PREFIX + sb.toString() + DEFAULT_RESOURCE_EXTENSION;  
+        String thePrefix = locationPrefix == null ? DEFAULT_LOCATION_PREFIX : locationPrefix;
+        String theExtension = resourceExtension == null ? DEFAULT_RESOURCE_EXTENSION : resourceExtension;
+        return thePrefix + sb.toString() + theExtension;  
     }
     
     public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
MediaType mt) {
@@ -232,11 +236,26 @@ public class RequestDispatcherProvider e
             }
         }
         
-        Object resourcePathProp = (String)mc.get(MESSAGE_RESOURCE_PATH_PROPERTY);
-        return resourcePathProp != null ? resourcePathProp.toString() : null;
+        return getPathFromMessageContext();
         
     }
     
+    private String getPathFromMessageContext() {
+        Object resourcePathProp = (String)mc.get(MESSAGE_RESOURCE_PATH_PROPERTY);
+        if (resourcePathProp != null) {
+            StringBuilder sb = new StringBuilder();
+            if (locationPrefix != null) {
+                sb.append(locationPrefix);
+            }
+            sb.append(resourcePathProp.toString());
+            if (resourceExtension != null) {
+                sb.append(resourceExtension);
+            }
+            return sb.toString();
+        }
+        return null;
+    }
+    
     private String getRequestPath() {
         Message inMessage = PhaseInterceptorChain.getCurrentMessage().getExchange().getInMessage();
         return (String)inMessage.get(Message.REQUEST_URI);



Mime
View raw message