This is an automated email from the ASF dual-hosted git repository. acosentino 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 68bd903 camel-servlet - Improve docs format (#2525) 68bd903 is described below commit 68bd9036ccbfc1219972188070ae86008eb76c0b Author: Tadayoshi Sato <sato.tadayo...@gmail.com> AuthorDate: Thu Sep 20 15:42:55 2018 +0900 camel-servlet - Improve docs format (#2525) --- .../src/main/docs/servlet-component.adoc | 50 ++++++++++++---------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/components/camel-servlet/src/main/docs/servlet-component.adoc b/components/camel-servlet/src/main/docs/servlet-component.adoc index b6d48eb..a22025d 100644 --- a/components/camel-servlet/src/main/docs/servlet-component.adoc +++ b/components/camel-servlet/src/main/docs/servlet-component.adoc @@ -16,12 +16,15 @@ for this component: <groupId>org.apache.camel</groupId> <artifactId>camel-servlet</artifactId> <version>x.x.x</version> - <\!-\- use the same version as your Camel core version \--> + <!-- use the same version as your Camel core version --> </dependency> --------------------------------------------------------------- -INFO: *Stream*. +[NOTE] +==== +*Stream* + Servlet is stream based, which means the input it receives is submitted to Camel as a stream. That means you will only be able to read the content of the stream *once*. If you find a situation where the message @@ -29,18 +32,19 @@ body appears to be empty or you need to access the data multiple times (eg: doing multicasting, or redelivery error handling) you should use Stream caching or convert the message body to a `String` which is safe to be read multiple times. +==== -### URI format +=== URI format [source,java] --------------------------------- servlet://relative_path[?options] --------------------------------- -You can append query options to the URI in the following format, +You can append query options to the URI in the following format: `?option=value&option=value&...` -### Options +=== Options // component options: START The Servlet component supports 9 options, which are listed below. @@ -139,24 +143,24 @@ The component supports 13 options, which are listed below. // spring-boot-auto-configure options: END -### Message Headers +=== Message Headers Camel will apply the same Message Headers as the <<http-component,HTTP>> component. Camel will also populate *all* `request.parameter` and `request.headers`. For example, if a client request has the URL, -`http://myserver/myserver?orderid=123`, the exchange will contain a +http://myserver/myserver?orderid=123, the exchange will contain a header named `orderid` with the value 123. -### Usage +=== Usage -You can consume only from endpoints generated by the Servlet component. +You can consume only `from` endpoints generated by the Servlet component. Therefore, it should be used only as input into your Camel routes. To issue HTTP requests against other HTTP endpoints, use the -<<http-component,HTTP Component>> +<<http-component,HTTP Component>>. -### Putting Camel JARs in the app server boot classpath +=== Putting Camel JARs in the app server boot classpath If you put the Camel JARs such as `camel-core`, `camel-servlet`, etc. in the boot classpath of your application server (eg usually in its lib @@ -211,18 +215,18 @@ follows: </servlet> ----------------------------------------------------------------------------------------------- -But its *strongly advised* to use unique servlet-name for each Camel +But it is *strongly advised* to use unique `servlet-name` for each Camel application to avoid this duplication clash, as well any unforeseen side-effects. -### Sample +=== Sample -INFO: From Camel 2.7 onwards it's easier to use <<servlet-component,Servlet>> in +NOTE: From Camel 2.7 onwards it's easier to use <<servlet-component,Servlet>> in Spring web applications. See link:servlet-tomcat-example.html[Servlet Tomcat Example] for details. In this sample, we define a route that exposes a HTTP service at -`http://localhost:8080/camel/services/hello`. + +http://localhost:8080/camel/services/hello. + First, you need to publish the http://svn.apache.org/repos/asf/camel/trunk/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/CamelHttpTransportServlet.java[CamelHttpTransportServlet] through the normal Web Container, or OSGi Service. + @@ -239,11 +243,11 @@ endpoint uses the relative path to specify the endpoint's URL. A client can access the `camel-servlet` endpoint through the servlet publish address: `("http://localhost:8080/camel/services") + RELATIVE_PATH("/hello")`. -#### Sample when using Spring 3.x +==== Sample when using Spring 3.x -See Servlet Tomcat Example +See link:servlet-tomcat-example.html[Servlet Tomcat Example]. -#### Sample when using Spring 2.x +==== Sample when using Spring 2.x When using the Servlet component in a Camel/Spring application it's often required to load the Spring ApplicationContext _after_ the Servlet @@ -274,7 +278,7 @@ like this: <web-app> ------------------------------------------------------------------------- -#### Sample when using OSGi +==== Sample when using OSGi From *Camel 2.6.0*, you can publish the http://svn.apache.org/repos/asf/camel/trunk/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/CamelHttpTransportServlet.java[CamelHttpTransportServlet] @@ -287,10 +291,10 @@ the http://svn.apache.org/repos/asf/camel/trunk/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/CamelHttpTransportServlet.java[CamelHttpTransportServlet] on the OSGi platform -#### Usage with Spring-Boot +==== Usage with Spring-Boot -From *Camel 2.19.0* onwards, the _camel-servlet-starter_ library binds automatically all the rest endpoints under the "/camel/*" context path. -The following table summarizes the additional configuration properties available in the camel-servlet-starter library. +From *Camel 2.19.0* onwards, the _camel-servlet-starter_ library binds automatically all the rest endpoints under the `/camel/*` context path. +The following table summarizes the additional configuration properties available in the _camel-servlet-starter_ library. The automatic mapping of the Camel servlet can also be disabled. [width="100%",cols="3,1m,6",options="header"] @@ -301,7 +305,7 @@ The automatic mapping of the Camel servlet can also be disabled. | camel.component.servlet.mapping.servlet-name | CamelServlet | The name of the Camel servlet |======================================================================= -### See Also +=== See Also * Configuring Camel * Component