Repository: camel Updated Branches: refs/heads/master 392ea1845 -> bf40fe8c0
CAMEL-8416: camel-jetty - Allow multiple restrict headers Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bf40fe8c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bf40fe8c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bf40fe8c Branch: refs/heads/master Commit: bf40fe8c0ca70916c4b62b1c7f2351612ed035f9 Parents: 392ea18 Author: Claus Ibsen <davscl...@apache.org> Authored: Sat Feb 28 11:48:00 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat Feb 28 11:48:00 2015 +0100 ---------------------------------------------------------------------- .../jetty/CamelContinuationServlet.java | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bf40fe8c/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java index 3ab15f2..78ba6db 100644 --- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java +++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java @@ -17,6 +17,7 @@ package org.apache.camel.component.jetty; import java.io.IOException; +import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.servlet.ServletException; @@ -31,6 +32,7 @@ import org.apache.camel.component.http.HttpConsumer; import org.apache.camel.component.http.HttpMessage; import org.apache.camel.component.http.helper.HttpHelper; import org.apache.camel.impl.DefaultExchange; +import org.apache.camel.util.ObjectHelper; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationSupport; @@ -63,10 +65,20 @@ public class CamelContinuationServlet extends CamelServlet { return; } - if (consumer.getEndpoint().getHttpMethodRestrict() != null - && !consumer.getEndpoint().getHttpMethodRestrict().equals(request.getMethod())) { - response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - return; + if (consumer.getEndpoint().getHttpMethodRestrict() != null) { + Iterator it = ObjectHelper.createIterable(consumer.getEndpoint().getHttpMethodRestrict()).iterator(); + boolean match = false; + while (it.hasNext()) { + String method = it.next().toString(); + if (method.equalsIgnoreCase(request.getMethod())) { + match = true; + break; + } + } + if (!match) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); + return; + } } if ("TRACE".equals(request.getMethod()) && !consumer.isTraceEnabled()) {