You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/09/12 23:11:44 UTC
svn commit: r1384127 - in /camel/branches/camel-2.9.x: ./
components/camel-restlet/src/main/java/org/apache/camel/component/restlet/
components/camel-restlet/src/test/java/org/apache/camel/component/restlet/
Author: bvahdat
Date: Wed Sep 12 21:11:43 2012
New Revision: 1384127
URL: http://svn.apache.org/viewvc?rev=1384127&view=rev
Log:
Merged revisions 1384125 via svnmerge from
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x
................
r1384125 | bvahdat | 2012-09-12 23:07:46 +0200 (Mi, 12 Sep 2012) | 9 lines
Merged revisions 1384122 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1384122 | bvahdat | 2012-09-12 23:01:07 +0200 (Mi, 12 Sep 2012) | 1 line
CAMEL-5600: Removed the last comma being put inside the URI.
........
................
Added:
camel/branches/camel-2.9.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletEndpointUpdateEndpointUriTest.java
- copied unchanged from r1384125, camel/branches/camel-2.10.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletEndpointUpdateEndpointUriTest.java
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1384122
Merged /camel/branches/camel-2.10.x:r1384125
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java?rev=1384127&r1=1384126&r2=1384127&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java (original)
+++ camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java Wed Sep 12 21:11:43 2012
@@ -66,7 +66,7 @@ public class RestletComponent extends He
private Boolean useForwardedForHeader;
public RestletComponent() {
- this.component = new Component();
+ this(new Component());
}
public RestletComponent(Component component) {
@@ -76,9 +76,7 @@ public class RestletComponent extends He
}
@Override
- @SuppressWarnings({"unchecked", "rawtypes"})
- protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
-
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
RestletEndpoint result = new RestletEndpoint(this, remaining);
setEndpointHeaderFilterStrategy(result);
setProperties(result, parameters);
Modified: camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java?rev=1384127&r1=1384126&r2=1384127&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java (original)
+++ camel/branches/camel-2.9.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java Wed Sep 12 21:11:43 2012
@@ -41,8 +41,8 @@ public class RestletEndpoint extends Def
private Method restletMethod = Method.GET;
- // Optional and for consumer only. This allows a single route to service multiple
- // methods. If it is non-null, restletMethod is ignored.
+ // Optional and for consumer only. This allows a single route to service multiple methods.
+ // If it is non-null then restletMethod is ignored.
private Method[] restletMethods;
private String protocol = DEFAULT_PROTOCOL;
@@ -50,8 +50,8 @@ public class RestletEndpoint extends Def
private int port = DEFAULT_PORT;
private String uriPattern;
- // Optional and for consumer only. This allows a single route to service multiple
- // URI patterns. The URI pattern defined in the endpoint will still be honored.
+ // Optional and for consumer only. This allows a single route to service multiple URI patterns.
+ // The URI pattern defined in the endpoint will still be honored.
private List<String> restletUriPatterns;
private Map<String, String> restletRealm;
@@ -191,17 +191,24 @@ public class RestletEndpoint extends Def
String endpointUri = getEndpointUri();
StringBuffer methods = new StringBuffer();
if (getRestletMethods() != null && getRestletMethods().length > 0) {
+ // list the method(s) as a comma seperated list
+ boolean first = true;
for (Method method : getRestletMethods()) {
- methods = methods.append(method.getName()).append(',');
+ if (first) {
+ first = false;
+ } else {
+ methods.append(',');
+ }
+ methods.append(method.getName());
}
} else {
- Method method = getRestletMethod();
- methods = methods.append(method.getName());
- }
- if (methods != null) {
- endpointUri = endpointUri + "?restletMethods=" + methods.toString();
- setEndpointUri(endpointUri);
+ // otherwise consider the single method we own
+ methods.append(getRestletMethod());
}
+
+ // update the uri
+ endpointUri = endpointUri + "?restletMethods=" + methods;
+ setEndpointUri(endpointUri);
}
@Override