You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/03/12 11:39:25 UTC

[camel] branch camel-3.1.x updated: CAMEL-14699: Add matchOnUriPrefix URI parameter to platform-http endpoint

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch camel-3.1.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.1.x by this push:
     new 496db8a  CAMEL-14699: Add matchOnUriPrefix URI parameter to platform-http endpoint
496db8a is described below

commit 496db8a6dfacd2013ca4987d1205a052f72117b9
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Mar 12 11:37:16 2020 +0000

    CAMEL-14699: Add matchOnUriPrefix URI parameter to platform-http endpoint
---
 .../platform/http/PlatformHttpEndpointConfigurer.java        |  2 ++
 .../apache/camel/component/platform/http/platform-http.json  |  1 +
 .../src/main/docs/platform-http-component.adoc               |  3 ++-
 .../camel/component/platform/http/PlatformHttpEndpoint.java  | 12 ++++++++++++
 .../modules/ROOT/pages/platform-http-component.adoc          |  3 ++-
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
index 4ddd11b..764abf8 100644
--- a/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
+++ b/components/camel-platform-http/src/generated/java/org/apache/camel/component/platform/http/PlatformHttpEndpointConfigurer.java
@@ -20,6 +20,8 @@ public class PlatformHttpEndpointConfigurer extends PropertyConfigurerSupport im
         case "consumes": target.setConsumes(property(camelContext, java.lang.String.class, value)); return true;
         case "httpmethodrestrict":
         case "httpMethodRestrict": target.setHttpMethodRestrict(property(camelContext, java.lang.String.class, value)); return true;
+        case "matchonuriprefix":
+        case "matchOnUriPrefix": target.setMatchOnUriPrefix(property(camelContext, boolean.class, value)); return true;
         case "produces": target.setProduces(property(camelContext, java.lang.String.class, value)); return true;
         case "exceptionhandler":
         case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
diff --git a/components/camel-platform-http/src/generated/resources/org/apache/camel/component/platform/http/platform-http.json b/components/camel-platform-http/src/generated/resources/org/apache/camel/component/platform/http/platform-http.json
index 5d40c07..bc07847 100644
--- a/components/camel-platform-http/src/generated/resources/org/apache/camel/component/platform/http/platform-http.json
+++ b/components/camel-platform-http/src/generated/resources/org/apache/camel/component/platform/http/platform-http.json
@@ -27,6 +27,7 @@
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "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 b [...]
     "consumes": { "kind": "parameter", "displayName": "Consumes", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The content type this endpoint accepts as an input, such as application\/xml or application\/json. null or &#42;\/&#42; mean no restriction." },
     "httpMethodRestrict": { "kind": "parameter", "displayName": "Http Method Restrict", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "A comma separated list of HTTP methods to serve, e.g. GET,POST . If no methods are specified, all methods will be served." },
+    "matchOnUriPrefix": { "kind": "parameter", "displayName": "Match On Uri Prefix", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "description": "Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found." },
     "produces": { "kind": "parameter", "displayName": "Produces", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The content type this endpoint produces, such as application\/xml or application\/json." },
     "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with [...]
     "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
diff --git a/components/camel-platform-http/src/main/docs/platform-http-component.adoc b/components/camel-platform-http/src/main/docs/platform-http-component.adoc
index 78c228d..0de9465 100644
--- a/components/camel-platform-http/src/main/docs/platform-http-component.adoc
+++ b/components/camel-platform-http/src/main/docs/platform-http-component.adoc
@@ -60,7 +60,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (11 parameters):
+=== Query Parameters (12 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -69,6 +69,7 @@ with the following path and query parameters:
 | *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
 | *consumes* (consumer) | The content type this endpoint accepts as an input, such as application/xml or application/json. null or &#42;/&#42; mean no restriction. |  | String
 | *httpMethodRestrict* (consumer) | A comma separated list of HTTP methods to serve, e.g. GET,POST . If no methods are specified, all methods will be served. |  | 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. | false | boolean
 | *produces* (consumer) | The content type this endpoint produces, such as application/xml or application/json. |  | String
 | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option 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. The value can be one of: InOnly, InOut, InOptionalOut |  | ExchangePattern
diff --git a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
index 8b78059..d80b43f 100644
--- a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
+++ b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
@@ -40,6 +40,10 @@ public class PlatformHttpEndpoint extends DefaultEndpoint implements AsyncEndpoi
     @Metadata(required = true)
     private final String path;
 
+    @UriParam(label = "consumer", defaultValue = "false", description = "Whether or not the consumer should try to find a target consumer "
+            + "by matching the URI prefix if no exact match is found.")
+    private boolean matchOnUriPrefix;
+
     @UriParam(label = "consumer", description = "A comma separated list of HTTP methods to serve, e.g. GET,POST ."
             + " If no methods are specified, all methods will be served.")
     private String httpMethodRestrict;
@@ -101,6 +105,14 @@ public class PlatformHttpEndpoint extends DefaultEndpoint implements AsyncEndpoi
         this.platformHttpEngine = platformHttpEngine;
     }
 
+    public boolean getMatchOnUriPrefix() {
+        return matchOnUriPrefix;
+    }
+
+    public void setMatchOnUriPrefix(boolean matchOnUriPrefix) {
+        this.matchOnUriPrefix = matchOnUriPrefix;
+    }
+
     public String getHttpMethodRestrict() {
         return httpMethodRestrict;
     }
diff --git a/docs/components/modules/ROOT/pages/platform-http-component.adoc b/docs/components/modules/ROOT/pages/platform-http-component.adoc
index 6dbd692..659fe89 100644
--- a/docs/components/modules/ROOT/pages/platform-http-component.adoc
+++ b/docs/components/modules/ROOT/pages/platform-http-component.adoc
@@ -61,7 +61,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (11 parameters):
+=== Query Parameters (12 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -70,6 +70,7 @@ with the following path and query parameters:
 | *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
 | *consumes* (consumer) | The content type this endpoint accepts as an input, such as application/xml or application/json. null or &#42;/&#42; mean no restriction. |  | String
 | *httpMethodRestrict* (consumer) | A comma separated list of HTTP methods to serve, e.g. GET,POST . If no methods are specified, all methods will be served. |  | 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. | false | boolean
 | *produces* (consumer) | The content type this endpoint produces, such as application/xml or application/json. |  | String
 | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option 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. The value can be one of: InOnly, InOut, InOptionalOut |  | ExchangePattern