This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 7446fcc Update camel-undertow doc summary that it can do WS also 7446fcc is described below commit 7446fcc65b87d5483d80359debb1a17172f00872 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Mar 5 09:50:10 2018 +0100 Update camel-undertow doc summary that it can do WS also --- .../src/main/docs/undertow-component.adoc | 74 +++++++++------------- .../camel/component/undertow/UndertowEndpoint.java | 11 ++-- components/readme.adoc | 2 +- .../springboot/UndertowComponentConfiguration.java | 4 +- 4 files changed, 36 insertions(+), 55 deletions(-) diff --git a/components/camel-undertow/src/main/docs/undertow-component.adoc b/components/camel-undertow/src/main/docs/undertow-component.adoc index bcbba9c..e586551 100644 --- a/components/camel-undertow/src/main/docs/undertow-component.adoc +++ b/components/camel-undertow/src/main/docs/undertow-component.adoc @@ -3,13 +3,14 @@ *Available as of Camel version 2.16* -The *undertow* component provides HTTP-based -endpoints for consuming and producing HTTP requests. -That is, the Undertow component behaves as a simple Web server. + - Undertow can also be used as a http client which mean you can also use +The *undertow* component provides HTTP and WebSocket based endpoints for consuming +and producing HTTP/WebSocket requests. + +That is, the Undertow component behaves as a simple Web server. +Undertow can also be used as a http client which mean you can also use it with Camel as a producer. -Since Camel version 2.21, the *undertow* component also supports WebSocket +TIP: Since Camel version 2.21, the *undertow* component also supports WebSocket connections and can thus serve as a drop-in replacement for Camel websocket component or atmosphere-websocket component. @@ -17,33 +18,29 @@ Maven users will need to add the following dependency to their `pom.xml` for this component: [source,xml] ------------------------------------------------------------- +---- <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-undertow</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency> ------------------------------------------------------------- +---- -### URI format +=== URI format -[source,java] -------------------------------------------------------- +[source,text] +---- undertow:http://hostname[:port][/resourceUri][?options] undertow:https://hostname[:port][/resourceUri][?options] undertow:ws://hostname[:port][/resourceUri][?options] undertow:wss://hostname[:port][/resourceUri][?options] -------------------------------------------------------- +---- You can append query options to the URI in the following format, `?option=value&option=value&...` -### Options - - - - +=== Options // component options: START The Undertow component supports 5 options which are listed below. @@ -62,11 +59,6 @@ The Undertow component supports 5 options which are listed below. // component options: END - - - - - // endpoint options: START The Undertow endpoint is configured using URI syntax: @@ -118,7 +110,7 @@ with the following path and query parameters: -### Message Headers +=== Message Headers Camel uses the same message headers as the <<http-component,HTTP>> component. @@ -131,7 +123,7 @@ example, given a client request with the URL, `http://myserver/myserver?orderid=123`, the exchange will contain a header named `orderid` with the value 123. -### Producer Example +=== Producer Example The following is a basic example of how to send an HTTP request to an existing HTTP endpoint. @@ -139,34 +131,36 @@ existing HTTP endpoint. in Java DSL [source,java] ----------------------------------------------------------- -from("direct:start").to("undertow:http://www.google.com"); ----------------------------------------------------------- +---- +from("direct:start") + .to("undertow:http://www.google.com"); +---- -or in Spring XML +or in XML [source,xml] ----------------------------------------------- +---- <route> <from uri="direct:start"/> <to uri="undertow:http://www.google.com"/> <route> ----------------------------------------------- +---- -### Consumer Example +=== Consumer Example In this sample we define a route that exposes a HTTP service at `http://localhost:8080/myapp/myservice`: [source,xml] --------------------------------------------------------------- +---- <route> <from uri="undertow:http://localhost:8080/myapp/myservice"/> <to uri="bean:myBean"/> </route> --------------------------------------------------------------- +---- + +=== Using localhost as host -NOTE:*Usage of localhost* When you specify `localhost` in a URL, Camel exposes the endpoint only on the local TCP/IP network interface, so it cannot be accessed from outside the machine it operates on. @@ -176,22 +170,12 @@ the numerical IP address of this interface should be used as the host. If you need to expose a Jetty endpoint on all network interfaces, the `0.0.0.0` address should be used. -TIP:To listen across an entire URI prefix, see +To listen across an entire URI prefix, see link:how-do-i-let-jetty-match-wildcards.html[How do I let Jetty match wildcards]. - -TIP:If you actually want to expose routes by HTTP and already have a +If you actually want to expose routes by HTTP and already have a Servlet, you should instead refer to the https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=46339[Servlet Transport]. -### See Also - -* Configuring Camel -* Component -* Endpoint -* Getting Started - -* <<jetty-component,Jetty>> -* <<http-component,HTTP>> 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 81403be..23c8caa 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 @@ -17,7 +17,6 @@ package org.apache.camel.component.undertow; import java.net.URI; -import java.net.URISyntaxException; import java.util.Locale; import java.util.Map; import javax.net.ssl.SSLContext; @@ -49,10 +48,10 @@ import org.xnio.OptionMap; import org.xnio.Options; /** - * The undertow component provides HTTP-based endpoints for consuming and producing HTTP requests. + * The undertow component provides HTTP and WebSocket based endpoints for consuming and producing HTTP/WebSocket requests. */ @UriEndpoint(firstVersion = "2.16.0", scheme = "undertow", title = "Undertow", syntax = "undertow:httpURI", - consumerClass = UndertowConsumer.class, label = "http", lenientProperties = true) + consumerClass = UndertowConsumer.class, label = "http,websocket", lenientProperties = true) public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, HeaderFilterStrategyAware { private static final Logger LOG = LoggerFactory.getLogger(UndertowEndpoint.class); @@ -87,8 +86,7 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, private Boolean reuseAddresses = Boolean.TRUE; @UriParam(label = "producer", prefix = "option.", multiValue = true) private Map<String, Object> options; - @UriParam(label = "consumer", - description = "Specifies whether to enable HTTP OPTIONS for this Servlet consumer. By default OPTIONS is turned off.") + @UriParam(label = "consumer") private boolean optionsEnabled; @UriParam(label = "producer") private CookieHandler cookieHandler; @@ -101,7 +99,7 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, @UriParam(label = "consumer,websocket", defaultValue = "false") private boolean fireWebSocketChannelEvents; - public UndertowEndpoint(String uri, UndertowComponent component) throws URISyntaxException { + public UndertowEndpoint(String uri, UndertowComponent component) { super(uri, component); this.component = component; } @@ -123,7 +121,6 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, @Override public PollingConsumer createPollingConsumer() throws Exception { - //throw exception as polling consumer is not supported throw new UnsupportedOperationException("This component does not support polling consumer"); } diff --git a/components/readme.adoc b/components/readme.adoc index f19d01d..af4e1dc 100644 --- a/components/readme.adoc +++ b/components/readme.adoc @@ -828,7 +828,7 @@ Number of Components: 291 in 199 JAR artifacts (19 deprecated) `twitter-timeline:timelineType` | 2.10 | The Twitter Timeline component consumes twitter timeline or update the status of specific user. | link:camel-undertow/src/main/docs/undertow-component.adoc[Undertow] (camel-undertow) + -`undertow:httpURI` | 2.16 | The undertow component provides HTTP-based endpoints for consuming and producing HTTP requests. +`undertow:httpURI` | 2.16 | The undertow component provides HTTP and WebSocket based endpoints for consuming and producing HTTP/WebSocket requests. | link:../camel-core/src/main/docs/validator-component.adoc[Validator] (camel-core) + `validator:resourceUri` | 1.1 | Validates the payload of a message using XML Schema and JAXP Validation. diff --git a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java index 95114fc..8936eeb 100644 --- a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentConfiguration.java @@ -24,8 +24,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; /** - * The undertow component provides HTTP-based endpoints for consuming and - * producing HTTP requests. + * The undertow component provides HTTP and WebSocket based endpoints for + * consuming and producing HTTP/WebSocket requests. * * Generated by camel-package-maven-plugin - do not edit this file! */ -- To stop receiving notification emails like this one, please contact davscl...@apache.org.