Repository: camel
Updated Branches:
  refs/heads/master 96a2f6c53 -> 2a1288e0a


CAMEL-11254-Default matchOnUriPrefix to false on Undertow endpoint


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

Branch: refs/heads/master
Commit: 2a1288e0aabc16284fd5de9a848e884377e3dce0
Parents: 96a2f6c
Author: onders86 <ondersez...@gmail.com>
Authored: Tue May 23 21:26:18 2017 +0300
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed May 24 09:35:23 2017 +0200

----------------------------------------------------------------------
 components/camel-undertow/src/main/docs/undertow-component.adoc  | 2 +-
 .../org/apache/camel/component/undertow/UndertowComponent.java   | 4 ++--
 .../org/apache/camel/component/undertow/UndertowEndpoint.java    | 4 ++--
 .../camel/component/undertow/handlers/CamelRootHandler.java      | 2 +-
 .../camel/component/undertow/UndertowPrefixMatchingTest.java     | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2a1288e0/components/camel-undertow/src/main/docs/undertow-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/docs/undertow-component.adoc 
b/components/camel-undertow/src/main/docs/undertow-component.adoc
index cf5883f..652322d 100644
--- a/components/camel-undertow/src/main/docs/undertow-component.adoc
+++ b/components/camel-undertow/src/main/docs/undertow-component.adoc
@@ -81,7 +81,7 @@ with the following path and query parameters:
 | Name | Description | Default | Type
 | **bridgeErrorHandler** (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages or the likes will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | **httpMethodRestrict** (consumer) | Used to only allow consuming if the 
HttpMethod matches such as GET/POST/PUT etc. Multiple methods can be specified 
separated by comma. |  | String
-| **matchOnUriPrefix** (consumer) | Whether or not the consumer should try to 
find a target consumer by matching the URI prefix if no exact match is found. | 
true | Boolean
+| **matchOnUriPrefix** (consumer) | Whether or not the consumer should try to 
find a target consumer by matching the URI prefix if no exact match is found. | 
false | Boolean
 | **optionsEnabled** (consumer) | Specifies whether to enable HTTP OPTIONS for 
this Servlet consumer. By default OPTIONS is turned off. | false | boolean
 | **exceptionHandler** (consumer) | To let the consumer use a custom 
ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this 
options is not in use. By default the consumer will deal with exceptions that 
will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
 | **exchangePattern** (consumer) | Sets the exchange pattern when the consumer 
creates an exchange. |  | ExchangePattern

http://git-wip-us.apache.org/repos/asf/camel/blob/2a1288e0/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
index 54affd1..bdb7616 100644
--- 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
+++ 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
@@ -208,9 +208,9 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
 
         String url;
         if (api) {
-            url = 
"undertow:%s://%s:%s/%s?matchOnUriPrefix=true&httpMethodRestrict=%s";
-        } else {
             url = "undertow:%s://%s:%s/%s?httpMethodRestrict=%s";
+        } else {
+            url = 
"undertow:%s://%s:%s/%s?matchOnUriPrefix=false&httpMethodRestrict=%s";
         }
 
         // must use upper case for restrict

http://git-wip-us.apache.org/repos/asf/camel/blob/2a1288e0/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
index 2b4e75a..32a6492 100644
--- 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
+++ 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
@@ -68,8 +68,8 @@ public class UndertowEndpoint extends DefaultEndpoint 
implements AsyncEndpoint,
     private SSLContextParameters sslContextParameters;
     @UriParam(label = "consumer")
     private String httpMethodRestrict;
-    @UriParam(label = "consumer", defaultValue = "true")
-    private Boolean matchOnUriPrefix = true;
+    @UriParam(label = "consumer", defaultValue = "false")
+    private Boolean matchOnUriPrefix = Boolean.FALSE;
     @UriParam(label = "producer", defaultValue = "true")
     private Boolean throwExceptionOnFailure = Boolean.TRUE;
     @UriParam(label = "producer", defaultValue = "false")

http://git-wip-us.apache.org/repos/asf/camel/blob/2a1288e0/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
----------------------------------------------------------------------
diff --git 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
index fe7c484..311b919 100644
--- 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
+++ 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelRootHandler.java
@@ -69,7 +69,7 @@ public class CamelRootHandler implements HttpHandler {
             // Adding a handler for the static path
             if (basePathHandler instanceof CamelPathTemplateHandler) {
                 CamelPathTemplateHandler templateHandler = 
(CamelPathTemplateHandler)basePathHandler;
-                if (prefixMatch) {
+                if (!prefixMatch) {
                     targetHandler = templateHandler.getDefault();
                 } else {
                     throw new 
IllegalArgumentException(String.format("Duplicate handlers on a path '%s'", 
path));

http://git-wip-us.apache.org/repos/asf/camel/blob/2a1288e0/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java
index f243b45..854b8e3 100644
--- 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java
@@ -51,11 +51,11 @@ public class UndertowPrefixMatchingTest extends 
BaseUndertowTest {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                
from("undertow:http://localhost:{{port}}/myapp/suffix?matchOnUriPrefix=false";)
+                from("undertow:http://localhost:{{port}}/myapp/suffix";)
                     .transform(bodyAs(String.class).append(" Must match exact 
path"))
                     .to("mock:myapp");
 
-                from("undertow:http://localhost:{{port}}/bar";)
+                
from("undertow:http://localhost:{{port}}/bar?matchOnUriPrefix=true";)
                     .transform(bodyAs(String.class).append(" Matching prefix"))
                     .to("mock:bar");
             }

Reply via email to