Updated Branches:
  refs/heads/camel-2.11.x 6e7036369 -> 7ca957f9c

CAMEL-6385 Applied patch with thanks to Yuejie


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7ca957f9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7ca957f9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7ca957f9

Branch: refs/heads/camel-2.11.x
Commit: 7ca957f9ce183728604876bbc15eb7d3c1b6a117
Parents: 6e70363
Author: Willem Jiang <[email protected]>
Authored: Thu May 23 16:42:37 2013 +0800
Committer: Willem Jiang <[email protected]>
Committed: Thu May 23 16:56:02 2013 +0800

----------------------------------------------------------------------
 .../camel/component/restlet/RestletComponent.java  |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7ca957f9/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
 
b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
index 55847cc..13ff0fc 100644
--- 
a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
+++ 
b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
@@ -135,13 +135,18 @@ public class RestletComponent extends 
HeaderFilterStrategyComponent {
         RestletEndpoint endpoint = consumer.getEndpoint();
         addServerIfNecessary(endpoint);
 
+        // if restlet servlet server is created, the offsetPath is set in 
component context
+        // see http://restlet.tigris.org/issues/show_bug.cgi?id=988
+        String offsetPath = (String) this.component.getContext()
+                .getAttributes().get("org.restlet.ext.servlet.offsetPath");
+        
         if (endpoint.getUriPattern() != null && 
endpoint.getUriPattern().length() > 0) {
-            attachUriPatternToRestlet(endpoint.getUriPattern(), endpoint, 
consumer.getRestlet());
+            attachUriPatternToRestlet(offsetPath, endpoint.getUriPattern(), 
endpoint, consumer.getRestlet());
         }
 
         if (endpoint.getRestletUriPatterns() != null) {
             for (String uriPattern : endpoint.getRestletUriPatterns()) {
-                attachUriPatternToRestlet(uriPattern, endpoint, 
consumer.getRestlet());
+                attachUriPatternToRestlet(offsetPath, uriPattern, endpoint, 
consumer.getRestlet());
             }
         }
     }
@@ -266,7 +271,7 @@ public class RestletComponent extends 
HeaderFilterStrategyComponent {
         return endpoint.getHost() + ":" + endpoint.getPort();
     }
 
-    private void attachUriPatternToRestlet(String uriPattern, RestletEndpoint 
endpoint, Restlet target) throws Exception {
+    private void attachUriPatternToRestlet(String offsetPath, String 
uriPattern, RestletEndpoint endpoint, Restlet target) throws Exception {
         uriPattern = decodePattern(uriPattern);
         MethodBasedRouter router = getMethodRouter(uriPattern, true);
 
@@ -297,7 +302,8 @@ public class RestletComponent extends 
HeaderFilterStrategyComponent {
         }
 
         if (!router.hasBeenAttached()) {
-            component.getDefaultHost().attach(uriPattern, router);
+            component.getDefaultHost().attach(
+                    offsetPath == null ? uriPattern : offsetPath + uriPattern, 
router);
             LOG.debug("Attached methodRouter uriPattern: {}", uriPattern);
         }
 

Reply via email to