Author: ningjiang
Date: Fri Aug 24 12:41:04 2012
New Revision: 1376895
URL: http://svn.apache.org/viewvc?rev=1376895&view=rev
Log:
Merged revisions 1376870 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1376870 | ningjiang | 2012-08-24 17:10:40 +0800 (Fri, 24 Aug 2012) | 1 line
CAMEL-5535 update endpoint uri to support multiple restlet routes of the same
restlet URI but different VERBs
........
Added:
camel/branches/camel-2.10.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiRoutesEndpointTest.java
- copied unchanged from r1376870,
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiRoutesEndpointTest.java
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1376870
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java?rev=1376895&r1=1376894&r2=1376895&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
Fri Aug 24 12:41:04 2012
@@ -82,6 +82,8 @@ public class RestletComponent extends He
RestletEndpoint result = new RestletEndpoint(this, remaining);
setEndpointHeaderFilterStrategy(result);
setProperties(result, parameters);
+ // set the endpoint uri according to the parameter
+ result.updateEndpointUri();
// construct URI so we can use it to get the splitted information
URI u = new URI(remaining);
Modified:
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java?rev=1376895&r1=1376894&r2=1376895&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
Fri Aug 24 12:41:04 2012
@@ -185,6 +185,24 @@ public class RestletEndpoint extends Def
public void setThrowExceptionOnFailure(boolean throwExceptionOnFailure) {
this.throwExceptionOnFailure = throwExceptionOnFailure;
}
+
+ // Update the endpointUri with the restlet method information
+ protected void updateEndpointUri() {
+ String endpointUri = getEndpointUri();
+ StringBuffer methods = new StringBuffer();
+ if (getRestletMethods() != null && getRestletMethods().length > 0) {
+ for (Method method : getRestletMethods()) {
+ methods = methods.append(method.getName()).append(',');
+ }
+ } else {
+ Method method = getRestletMethod();
+ methods = methods.append(method.getName());
+ }
+ if (methods != null) {
+ endpointUri = endpointUri + "?restletMethods=" +
methods.toString();
+ setEndpointUri(endpointUri);
+ }
+ }
@Override
protected void doStart() throws Exception {