You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/06/08 11:38:16 UTC

[1/3] camel git commit: Added camel-spring-ws docs to Gitbook

Repository: camel
Updated Branches:
  refs/heads/master 7474d9d16 -> ff46f80f8


Added camel-spring-ws docs to Gitbook


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

Branch: refs/heads/master
Commit: ff46f80f8f920dfacd47804b40d2b6c3b583d259
Parents: 48f129c
Author: Andrea Cosentino <an...@gmail.com>
Authored: Wed Jun 8 13:37:38 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed Jun 8 13:38:00 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/spring-ws.adoc                | 588 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 589 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ff46f80f/components/camel-spring-ws/src/main/docs/spring-ws.adoc
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/docs/spring-ws.adoc b/components/camel-spring-ws/src/main/docs/spring-ws.adoc
new file mode 100644
index 0000000..ed86d56
--- /dev/null
+++ b/components/camel-spring-ws/src/main/docs/spring-ws.adoc
@@ -0,0 +1,588 @@
+[[SpringWebServices-SpringWebServicesComponent]]
+Spring Web Services Component
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.6*
+
+The *spring-ws:* component allows you to integrate with
+http://static.springsource.org/spring-ws/sites/1.5/[Spring Web
+Services]. It offers both _client_-side support, for accessing web
+services, and _server_-side support for creating your own contract-first
+web services.
+
+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-spring-ws</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+INFO:*Dependencies*
+As of Camel 2.8 this component ships with Spring-WS 2.0.x which (like
+the rest of Camel) requires Spring 3.0.x.
+Earlier Camel versions shipped Spring-WS 1.5.9 which is compatible with
+Spring 2.5.x and 3.0.x. In order to run earlier versions of
+`camel-spring-ws` on Spring 2.5.x you need to add the `spring-webmvc`
+module from Spring 2.5.x. In order to run Spring-WS 1.5.9 on Spring
+3.0.x you need to exclude the OXM module from Spring 3.0.x as this
+module is also included in Spring-WS 1.5.9 (see
+http://stackoverflow.com/questions/3313314/can-spring-ws-1-5-be-used-with-spring-3[this
+post])
+
+[[SpringWebServices-URIformat]]
+URI format
+^^^^^^^^^^
+
+The URI scheme for this component is as follows
+
+[source,java]
+------------------------------------------
+spring-ws:[mapping-type:]address[?options]
+------------------------------------------
+
+To expose a web service *mapping-type* needs to be set to any of the
+following:
+
+[width="100%",cols="10%,90%",options="header",]
+|=======================================================================
+|Mapping type |Description
+
+|`rootqname` |Offers the option to map web service requests based on the qualified
+name of the root element contained in the message.
+
+|`soapaction` |Used to map web service requests based on the SOAP action specified in
+the header of the message.
+
+|`uri` |In order to map web service requests that target a specific URI.
+
+|`xpathresult` |Used to map web service requests based on the evaluation of an XPath
+`expression` against the incoming message. The result of the evaluation
+should match the XPath result specified in the endpoint URI.
+
+|`beanname` |Allows you to reference an
+`org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher`
+object in order to integrate with existing (legacy)
+http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html#server-endpoint-mapping[endpoint
+mappings] like `PayloadRootQNameEndpointMapping`,
+`SoapActionEndpointMapping`, etc
+|=======================================================================
+
+As a consumer the *address* should contain a value relevant to the
+specified mapping-type (e.g. a SOAP action, XPath expression). As a
+producer the address should be set to the URI of the web service your
+calling upon.
+
+You can append query *options* to the URI in the following format,
+`?option=value&option=value&...`
+
+[[SpringWebServices-Options]]
+Options
+^^^^^^^
+
+
+// component options: START
+The Spring WebService component has no options.
+// component options: END
+
+
+
+// endpoint options: START
+The Spring WebService component supports 23 endpoint options which are listed below:
+
+{% raw %}
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| type | consumer |  | EndpointMappingType | Endpoint mapping type if endpoint mapping is used. rootqname - Offers the option to map web service requests based on the qualified name of the root element contained in the message. soapaction - Used to map web service requests based on the SOAP action specified in the header of the message. uri - In order to map web service requests that target a specific URI. xpathresult - Used to map web service requests based on the evaluation of an XPath expression against the incoming message. The result of the evaluation should match the XPath result specified in the endpoint URI. beanname - Allows you to reference an org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher object in order to integrate with existing (legacy) endpoint mappings like PayloadRootQNameEndpointMapping SoapActionEndpointMapping etc
+| lookupKey | consumer |  | String | Endpoint mapping key if endpoint mapping is used
+| webServiceEndpointUri | producer |  | String | The default Web Service endpoint uri to use for the producer.
+| messageFilter | common |  | MessageFilter | Option to provide a custom MessageFilter. For example when you want to process your headers or attachments by your own.
+| bridgeErrorHandler | consumer | false | boolean | 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/ERROR level and ignored.
+| endpointDispatcher | consumer |  | CamelEndpointDispatcher | Spring org.springframework.ws.server.endpoint.MessageEndpoint for dispatching messages received by Spring-WS to a Camel endpoint to integrate with existing (legacy) endpoint mappings like PayloadRootQNameEndpointMapping SoapActionEndpointMapping etc.
+| endpointMapping | consumer |  | CamelSpringWSEndpointMapping | Reference to an instance of org.apache.camel.component.spring.ws.bean.CamelEndpointMapping in the Registry/ApplicationContext. Only one bean is required in the registry to serve all Camel/Spring-WS endpoints. This bean is auto-discovered by the MessageDispatcher and used to map requests to Camel endpoints based on characteristics specified on the endpoint (like root QName SOAP action etc)
+| expression | consumer |  | String | The XPath expression to use when option type=xpathresult. Then this option is required to be configured.
+| sslContextParameters | consumer |  | SSLContextParameters | To configure security using SSLContextParameters
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | 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/ERROR level and ignored.
+| faultAction | producer |  | URI | Signifies the value for the faultAction response WS-Addressing Fault Action header that is provided by the method.
+| faultTo | producer |  | URI | Signifies the value for the faultAction response WS-Addressing FaultTo header that is provided by the method.
+| messageFactory | producer |  | WebServiceMessageFactory | Option to provide a custom WebServiceMessageFactory. For example when you want Apache Axiom to handle web service messages instead of SAAJ.
+| messageIdStrategy | producer |  | MessageIdStrategy | Option to provide a custom MessageIdStrategy to control generation of unique message ids.
+| messageSender | producer |  | WebServiceMessageSender | Option to provide a custom WebServiceMessageSender. For example to perform authentication or use alternative transports
+| outputAction | producer |  | URI | Signifies the value for the response WS-Addressing Action header that is provided by the method.
+| replyTo | producer |  | URI | Signifies the value for the replyTo response WS-Addressing ReplyTo header that is provided by the method.
+| soapAction | producer |  | String | SOAP action to include inside a SOAP request when accessing remote web services
+| timeout | producer |  | int | Sets the socket read timeout (in milliseconds) while invoking a webservice using the producer see URLConnection.setReadTimeout() and CommonsHttpMessageSender.setReadTimeout(). This option works when using the built-in message sender implementations: CommonsHttpMessageSender and HttpUrlConnectionMessageSender. One of these implementations will be used by default for HTTP based services unless you customize the Spring WS configuration options supplied to the component. If you are using a non-standard sender it is assumed that you will handle your own timeout configuration. The built-in message sender HttpComponentsMessageSender is considered instead of CommonsHttpMessageSender which has been deprecated see HttpComponentsMessageSender.setReadTimeout().
+| webServiceTemplate | producer |  | WebServiceTemplate | Option to provide a custom WebServiceTemplate. This allows for full control over client-side web services handling; like adding a custom interceptor or specifying a fault resolver message sender or message factory.
+| wsAddressingAction | producer |  | URI | WS-Addressing 1.0 action header to include when accessing web services. The To header is set to the address of the web service as specified in the endpoint URI (default Spring-WS behavior).
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+{% endraw %}
+// endpoint options: END
+
+
+[[SpringWebServices-Messageheaders]]
+Message headers
++++++++++++++++
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelSpringWebserviceEndpointUri` |String |URI of the web service your accessing as a client, overrides _address_
+part of the endpoint URI
+
+|`CamelSpringWebserviceSoapAction` |String |Header to specify the SOAP action of the message, overrides `soapAction`
+option if present
+
+|CamelSpringWebserviceSoapHeader |Source |*Camel 2.11.1:* Use this header to specify/access the SOAP headers of
+the message.
+
+|`CamelSpringWebserviceAddressingAction` |URI |Use this header to specify the WS-Addressing action of the message,
+overrides `wsAddressingAction` option if present
+
+|CamelSpringWebserviceAddressingFaultTo |URI |Use this header to specify the �WS-Addressing FaultTo , overrides
+faultTo option if present
+
+|CamelSpringWebserviceAddressingReplyTo |URI |Use this header to specify the �WS-Addressing ReplyTo , overrides
+replyTo option if present
+
+|CamelSpringWebserviceAddressingOutputAction |URI |Use this header to specify the WS-Addressing Action , overrides
+outputAction option if present
+
+|CamelSpringWebserviceAddressingFaultAction |URI |Use this header to specify the WS-Addressing Fault Action , overrides
+faultAction option if present
+|=======================================================================
+
+[[SpringWebServices-Accessingwebservices]]
+Accessing web services
+~~~~~~~~~~~~~~~~~~~~~~
+
+To call a web service at `http://foo.com/bar` simply define a route:
+
+[source,java]
+---------------------------------------------------------
+from("direct:example").to("spring-ws:http://foo.com/bar")
+---------------------------------------------------------
+
+And sent a message:
+
+[source,java]
+------------------------------------------------------------------------------------------------------------
+template.requestBody("direct:example", "<foobar xmlns=\"http://foo.com\"><msg>test message</msg></foobar>");
+------------------------------------------------------------------------------------------------------------
+
+Remember if it's a SOAP service you're calling you don't have to include
+SOAP tags. Spring-WS will perform the XML-to-SOAP marshaling.
+
+[[SpringWebServices-SendingSOAPandWS-Addressingactionheaders]]
+Sending SOAP and WS-Addressing action headers
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When a remote web service requires a SOAP action or use of the
+WS-Addressing standard you define your route as:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+from("direct:example")
+.to("spring-ws:http://foo.com/bar?soapAction=http://foo.com&wsAddressingAction=http://bar.com")
+-----------------------------------------------------------------------------------------------
+
+Optionally you can override the endpoint options with header values:
+
+[source,java]
+--------------------------------------------------------------------
+template.requestBodyAndHeader("direct:example",
+"<foobar xmlns=\"http://foo.com\"><msg>test message</msg></foobar>",
+SpringWebserviceConstants.SPRING_WS_SOAP_ACTION, "http://baz.com");
+--------------------------------------------------------------------
+
+[[SpringWebServices-UsingSOAPheaders]]
+Using SOAP headers
+^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.11.1*
+
+You can provide the SOAP header(s) as a Camel Message header when
+sending a message to a spring-ws endpoint, for example given the
+following SOAP header in a String
+
+[source,java]
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+String body = ...
+String soapHeader = "<h:Header xmlns:h=\"http://www.webserviceX.NET/\"><h:MessageID>1234567890</h:MessageID><h:Nested><h:NestedID>1111</h:NestedID></h:Nested></h:Header>";
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+We can set the body and header on the Camel Message as follows:
+
+[source,java]
+----------------------------------------------------------------------------------------
+exchange.getIn().setBody(body);
+exchange.getIn().setHeader(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER, soapHeader);
+----------------------------------------------------------------------------------------
+
+And then send the Exchange to a `spring-ws` endpoint to call the Web
+Service.
+
+Likewise the spring-ws consumer will also enrich the Camel Message with
+the SOAP header.
+
+For an example see this
+https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java[unit
+test].
+
+[[SpringWebServices-Theheaderandattachmentpropagation]]
+The header and attachment propagation
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Spring WS Camel supports propagation of the headers and attachments into
+Spring-WS WebServiceMessage response since version *2.10.3*.�The
+endpoint will use so called "hook" the MessageFilter (default
+implementation is provided by BasicMessageFilter) to propagate the
+exchange headers and attachments into WebServiceMessage response.�Now
+you can use
+
+[source,java]
+--------------------------------------------------------------------
+exchange.getOut().getHeaders().put("myCustom","myHeaderValue")
+exchange.getIn().addAttachment("myAttachment", new DataHandler(...))
+--------------------------------------------------------------------
+
+Note: If the exchange header in the pipeline contains text, it generates
+Qname(key)=value attribute in the soap header. Recommended is to create
+a QName class directly and put into any key into header.
+
+[[SpringWebServices-HowtouseMTOMattachments]]
+How to use MTOM attachments
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The BasicMessageFilter provides all required information for Apache
+Axiom in order to produce MTOM message. If you want to use Apache Camel
+Spring WS within Apache Axiom, here is an example: 
+- Simply define the messageFactory as is bellow and Spring-WS will use
+MTOM strategy to populate your SOAP message with optimized attachments.
+
+[source,java]
+------------------------------------------------------------------
+<bean id="axiomMessageFactory"
+class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
+<property name="payloadCaching" value="false" />
+<property name="attachmentCaching" value="true" />
+<property name="attachmentCacheThreshold" value="1024" />
+</bean>
+------------------------------------------------------------------
+
+- Add into your pom.xml the following dependencies
+
+[source,java]
+----------------------------------------------
+<dependency>
+<groupId>org.apache.ws.commons.axiom</groupId>
+<artifactId>axiom-api</artifactId>
+<version>1.2.13</version>
+</dependency>
+<dependency>
+<groupId>org.apache.ws.commons.axiom</groupId>
+<artifactId>axiom-impl</artifactId>
+<version>1.2.13</version>
+<scope>runtime</scope>
+</dependency>
+----------------------------------------------
+
+- Add your attachment into the pipeline, for example using a Processor
+implementation.
+
+[source,java]
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+private class Attachement implements Processor {
+public void process(Exchange exchange) throws Exception
+{ exchange.getOut().copyFrom(exchange.getIn()); File file = new File("testAttachment.txt"); exchange.getOut().addAttachment("test", new DataHandler(new FileDataSource(file)));  }
+}
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+- Define endpoint (producer) as ussual, for example like this:
+
+[source,java]
+----------------------------------------------------------------------------------------------------------
+from("direct:send")
+.process(new Attachement())
+.to("spring-ws:http://localhost:8089/mySoapService?soapAction=mySoap&messageFactory=axiomMessageFactory");
+----------------------------------------------------------------------------------------------------------
+
+- Now, your producer will generate MTOM message with otpmized
+attachments.
+
+[[SpringWebServices-Thecustomheaderandattachmentfiltering]]
+The custom header and attachment filtering
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If you need to provide your custom processing of either headers or
+attachments, extend existing BasicMessageFilter and override the
+appropriate methods or write a brand new implementation of the
+MessageFilter interface. +
+ To use your custom filter, add this into your spring context:
+
+You can specify either a global a or a local message filter as
+follows: 
+ a) the global custom filter that provides the global configuration for
+all Spring-WS endpoints
+
+[source,java]
+--------------------------------------------------------------------------------
+ 
+<bean id="messageFilter" class="your.domain.myMessageFiler" scope="singleton" />
+--------------------------------------------------------------------------------
+
+or
+ b) the local messageFilter directly on the endpoint as follows:
+
+[source,java]
+-------------------------------------------------------------------------------------
+to("spring-ws:http://yourdomain.com?messageFilter=#myEndpointSpecificMessageFilter");
+-------------------------------------------------------------------------------------
+
+For more information see
+https://issues.apache.org/jira/browse/CAMEL-5724[CAMEL-5724]
+
+If you want to create your own MessageFilter, consider overriding the
+following methods in the default implementation of MessageFilter in
+class BasicMessageFilter:
+
+[source,java]
+-------------------------------------------------------------------------------
+protected void doProcessSoapHeader(Message inOrOut, SoapMessage soapMessage)
+{your code /*no need to call super*/ }
+
+protected void doProcessSoapAttachements(Message inOrOut, SoapMessage response)
+{ your code /*no need to call super*/ }
+-------------------------------------------------------------------------------
+
+[[SpringWebServices-UsingacustomMessageSenderandMessageFactory]]
+Using a custom MessageSender and MessageFactory
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A custom message sender or factory in the registry can be referenced
+like this:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+from("direct:example")
+.to("spring-ws:http://foo.com/bar?messageFactory=#messageFactory&messageSender=#messageSender")
+-----------------------------------------------------------------------------------------------
+
+Spring configuration:
+
+[source,xml]
+---------------------------------------------------------------------------------------------------------------------
+<!-- authenticate using HTTP Basic Authentication -->
+<bean id="messageSender" class="org.springframework.ws.transport.http.HttpComponentsMessageSender">
+    <property name="credentials">
+        <bean class="org.apache.commons.httpclient.UsernamePasswordCredentials">
+            <constructor-arg index="0" value="admin"/>
+            <constructor-arg index="1" value="secret"/>
+        </bean>
+    </property>
+</bean>
+
+<!-- force use of Sun SAAJ implementation, http://static.springsource.org/spring-ws/sites/1.5/faq.html#saaj-jboss -->
+<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
+    <property name="messageFactory">
+        <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"></bean>
+    </property>
+</bean>
+---------------------------------------------------------------------------------------------------------------------
+
+[[SpringWebServices-Exposingwebservices]]
+Exposing web services
+~~~~~~~~~~~~~~~~~~~~~
+
+In order to expose a web service using this component you first need to
+set-up a
+http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html[MessageDispatcher]
+to look for endpoint mappings in a Spring XML file. If you plan on
+running inside a servlet container you probably want to use a
+`MessageDispatcherServlet` configured in `web.xml`.
+
+By default the `MessageDispatcherServlet` will look for a Spring XML
+named `/WEB-INF/spring-ws-servlet.xml`. To use Camel with Spring-WS the
+only mandatory bean in that XML file is `CamelEndpointMapping`. This
+bean allows the `MessageDispatcher` to dispatch web service requests to
+your routes.
+
+_web.xml_
+
+[source,xml]
+-----------------------------------------------------------------------------------------------------
+<web-app>
+    <servlet>
+        <servlet-name>spring-ws</servlet-name>
+        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>spring-ws</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
+-----------------------------------------------------------------------------------------------------
+
+_spring-ws-servlet.xml_
+
+[source,xml]
+----------------------------------------------------------------------------------------------------
+<bean id="endpointMapping" class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping" />
+
+<bean id="wsdl" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
+    <property name="schema">
+        <bean class="org.springframework.xml.xsd.SimpleXsdSchema">
+            <property name="xsd" value="/WEB-INF/foobar.xsd"/>
+        </bean>
+    </property>
+    <property name="portTypeName" value="FooBar"/>
+    <property name="locationUri" value="/"/>
+    <property name="targetNamespace" value="http://example.com/"/>
+</bean>
+----------------------------------------------------------------------------------------------------
+
+More information on setting up Spring-WS can be found in
+http://static.springsource.org/spring-ws/sites/1.5/reference/html/tutorial.html[Writing
+Contract-First Web Services]. Basically paragraph 3.6 "Implementing the
+Endpoint" is handled by this component (specifically paragraph 3.6.2
+"Routing the Message to the Endpoint" is where `CamelEndpointMapping`
+comes in). Also don't forget to check out the
+link:spring-ws-example.html[Spring Web Services Example] included in the
+Camel distribution.
+
+[[SpringWebServices-Endpointmappinginroutes]]
+Endpoint mapping in routes
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+With the XML configuration in-place you can now use Camel's DSL to
+define what web service requests are handled by your endpoint:
+
+The following route will receive all web service requests that have a
+root element named "GetFoo" within the `http://example.com/` namespace.
+
+[source,java]
+----------------------------------------------------------------------------------------
+from("spring-ws:rootqname:{http://example.com/}GetFoo?endpointMapping=#endpointMapping")
+.convertBodyTo(String.class).to(mock:example)
+----------------------------------------------------------------------------------------
+
+The following route will receive web service requests containing the
+`http://example.com/GetFoo` SOAP action.
+
+[source,java]
+---------------------------------------------------------------------------------------
+from("spring-ws:soapaction:http://example.com/GetFoo?endpointMapping=#endpointMapping")
+.convertBodyTo(String.class).to(mock:example)
+---------------------------------------------------------------------------------------
+
+The following route will receive all requests sent to
+`http://example.com/foobar`.
+
+[source,java]
+--------------------------------------------------------------------------------
+from("spring-ws:uri:http://example.com/foobar?endpointMapping=#endpointMapping")
+.convertBodyTo(String.class).to(mock:example)
+--------------------------------------------------------------------------------
+
+The route below will receive requests that contain the element
+`<foobar>abc</foobar>` anywhere inside the message (and the default
+namespace).
+
+[source,java]
+--------------------------------------------------------------------------------------
+from("spring-ws:xpathresult:abc?expression=//foobar&endpointMapping=#endpointMapping")
+.convertBodyTo(String.class).to(mock:example)
+--------------------------------------------------------------------------------------
+
+[[SpringWebServices-Alternativeconfiguration,usingexistingendpointmappings]]
+Alternative configuration, using existing endpoint mappings
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+For every endpoint with mapping-type `beanname` one bean of type
+`CamelEndpointDispatcher` with a corresponding name is required in the
+Registry/ApplicationContext. This bean acts as a bridge between the
+Camel endpoint and an existing
+http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html#server-endpoint-mapping[endpoint
+mapping] like `PayloadRootQNameEndpointMapping`.
+
+NOTE:The use of the `beanname` mapping-type is primarily meant for (legacy)
+situations where you're already using Spring-WS and have endpoint
+mappings defined in a Spring XML file. The `beanname` mapping-type
+allows you to wire your Camel route into an existing endpoint mapping.
+When you're starting from scratch it's recommended to define your
+endpoint mappings as Camel URI's (as illustrated above with
+`endpointMapping`) since it requires less configuration and is more
+expressive. Alternatively you could use vanilla Spring-WS with the help
+of annotations.
+
+An example of a route using `beanname`:
+
+[source,java]
+------------------------------------------------------------------------------------------------------------------------
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+        <from uri="spring-ws:beanname:QuoteEndpointDispatcher" />
+        <to uri="mock:example" />
+    </route>
+</camelContext>
+
+<bean id="legacyEndpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
+    <property name="mappings">
+        <props>
+            <prop key="{http://example.com/}GetFuture">FutureEndpointDispatcher</prop>
+            <prop key="{http://example.com/}GetQuote">QuoteEndpointDispatcher</prop>
+        </props>
+    </property>
+</bean>
+
+<bean id="QuoteEndpointDispatcher" class="org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher" />
+<bean id="FutureEndpointDispatcher" class="org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher" />
+------------------------------------------------------------------------------------------------------------------------
+
+[[SpringWebServices-POJO-unmarshalling]]
+POJO (un)marshalling
+~~~~~~~~~~~~~~~~~~~~
+
+Camel's link:data-format.html[pluggable data formats] offer support for
+pojo/xml marshalling using libraries such as JAXB, XStream, JibX, Castor
+and XMLBeans. You can use these data formats in your route to sent and
+receive pojo's, to and from web services.
+
+When _accessing_ web services you can marshal the request and unmarshal
+the response message:
+
+[source,java]
+----------------------------------------------------------------------------------------
+JaxbDataFormat jaxb = new JaxbDataFormat(false);
+jaxb.setContextPath("com.example.model");
+
+from("direct:example").marshal(jaxb).to("spring-ws:http://foo.com/bar").unmarshal(jaxb);
+----------------------------------------------------------------------------------------
+
+Similarly when _providing_ web services, you can unmarshal XML requests
+to POJO's and marshal the response message back to XML:
+
+[source,java]
+--------------------------------------------------------------------------------------------------------
+from("spring-ws:rootqname:{http://example.com/}GetFoo?endpointMapping=#endpointMapping").unmarshal(jaxb)
+.to("mock:example").marshal(jaxb);
+--------------------------------------------------------------------------------------------------------
+
+[[SpringWebServices-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/ff46f80f/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index d698754..ad36752 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -254,6 +254,7 @@
     * [Spring-Ldap](spring-ldap.adoc)
     * [Spring-Redis](spring-redis.adoc)
     * [Spring-Security](spring-security.adoc)
+    * [Spring-Web-Services](spring-ws.adoc)
     * [Telegram](telegram.adoc)
     * [Twitter](twitter.adoc)
     * [Websocket](websocket.adoc)


[3/3] camel git commit: Added camel-spring-redis docs to Gitbook

Posted by ac...@apache.org.
Added camel-spring-redis docs to Gitbook


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

Branch: refs/heads/master
Commit: 438273dbeccfbbf97d3945cbfd27a6066569966a
Parents: 7474d9d
Author: Andrea Cosentino <an...@gmail.com>
Authored: Wed Jun 8 13:17:24 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed Jun 8 13:38:00 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/spring-redis.adoc             | 376 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 377 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/438273db/components/camel-spring-redis/src/main/docs/spring-redis.adoc
----------------------------------------------------------------------
diff --git a/components/camel-spring-redis/src/main/docs/spring-redis.adoc b/components/camel-spring-redis/src/main/docs/spring-redis.adoc
new file mode 100644
index 0000000..6b2bf1c
--- /dev/null
+++ b/components/camel-spring-redis/src/main/docs/spring-redis.adoc
@@ -0,0 +1,376 @@
+[[SpringRedis-SpringRedisComponent]]
+Spring Redis Component
+~~~~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.11*
+
+This component allows sending and receiving messages from
+http://http//redis.io/[Redis]. Redis is advanced key-value store where
+keys can contain strings, hashes, lists, sets and sorted sets. In
+addition it provides pub/sub functionality for inter-app
+communications. +
+ Camel provides a producer for executing commands, consumer for
+subscribing to pub/sub messages an idempotent repository for filtering
+out duplicate messages.
+
+INFO:*Prerequisites*
+In order to use this component, you must have a Redis server running.
+
+
+[[SpringRedis-URIFormat]]
+URI Format
+^^^^^^^^^^
+
+[source,java]
+----------------------------------
+spring-redis://host:port[?options]
+----------------------------------
+
+You can append query options to the URI in the following format,
+`?options=value&option2=value&...`
+
+[[SpringRedis-URIOptions]]
+URI Options
+^^^^^^^^^^^
+
+
+// component options: START
+The Spring Redis component has no options.
+// component options: END
+
+
+
+// endpoint options: START
+The Spring Redis component supports 12 endpoint options which are listed below:
+
+{% raw %}
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| host | common |  | String | *Required* The host where Redis server is running.
+| port | common |  | Integer | *Required* Redis server port number
+| channels | common |  | String | List of topic names or name patterns to subscribe to. Multiple names can be separated by comma.
+| command | common | SET | Command | Default command which can be overridden by message header. Notice the consumer only supports the following commands: PSUBSCRIBE and SUBSCRIBE
+| connectionFactory | common |  | RedisConnectionFactory | Reference to a pre-configured RedisConnectionFactory instance to use.
+| listenerContainer | common |  | RedisMessageListenerContainer | Reference to a pre-configured RedisMessageListenerContainer instance to use.
+| redisTemplate | common |  | RedisTemplate | Reference to a pre-configured RedisTemplate instance to use.
+| serializer | common |  | RedisSerializer | Reference to a pre-configured RedisSerializer instance to use.
+| bridgeErrorHandler | consumer | false | boolean | 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/ERROR level and ignored.
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | 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/ERROR level and ignored.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+{% endraw %}
+// endpoint options: END
+
+
+[[SpringRedis-Usage]]
+Usage
+^^^^^
+
+See also the unit tests available
+at�https://github.com/apache/camel/tree/master/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis[https://github.com/apache/camel/tree/master/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis].
+
+[[SpringRedis-MessageheadersevaluatedbytheRedisproducer]]
+Message headers evaluated by the Redis producer
++++++++++++++++++++++++++++++++++++++++++++++++
+
+The producer issues commands to the server and each command has
+different set of parameters with specific types. The result from the
+command execution is returned in the message body.
+
+[width="100%",cols="20%,20%,20%,60%",options="header",]
+|=======================================================================
+|Hash Commands |Description |Parameters |Result
+
+|`HSET` |Set the string value of a hash field |CamelRedis.Key (String), CamelRedis.Field (String), CamelRedis.Value
+(Object) |void
+
+|`HGET` |Get the value of a hash field |CamelRedis.Key (String), CamelRedis.Field (String) |String
+
+|`HSETNX` |Set the value of a hash field, only if the field does not exist |CamelRedis.Key (String), CamelRedis.Field (String), CamelRedis.Value
+(Object) |void
+
+|`HMSET` |Set multiple hash fields to multiple values |CamelRedis.Key (String), CamelRedis.Values(Map<String, Object>) |void
+
+|`HMGET` |Get the values of all the given hash fields |CamelRedis.Key (String), CamelRedis.Fields (Collection<String>) |Collection<Object>
+
+|`HINCRBY` |Increment the integer value of a hash field by the given number |CamelRedis.Key (String), CamelRedis.Field (String), CamelRedis.Value
+(Long) |Long
+
+|`HEXISTS` |Determine if a hash field exists |CamelRedis.Key (String), CamelRedis.Field (String) |Boolean
+
+|`HDEL` |Delete one or more hash fields |CamelRedis.Key (String), CamelRedis.Field (String) |void 
+
+|`HLEN` |Get the number of fields in a hash |CamelRedis.Key (String) |Long
+
+|`HKEYS` |Get all the fields in a hash |CamelRedis.Key (String) |Set<String>
+
+|`HVALS` |Get all the values in a hash |CamelRedis.Key (String) |Collection<Object>
+
+|`HGETALL` |Get all the fields and values in a hash |CamelRedis.Key (String) |Map<String, Object>
+|=======================================================================
+
+[width="100%",cols="20%,20%,20%,60%",options="header",]
+|=======================================================================
+|List Commands |Description |Parameters |Result
+
+|`RPUSH` |Append one or multiple values to a list |CamelRedis.Key (String), CamelRedis.Value (Object) |Long
+
+|`RPUSHX` |Append a value to a list, only if the list exists |CamelRedis.Key (String), CamelRedis.Value (Object) |Long
+
+|`LPUSH` |Prepend one or multiple values to a list |CamelRedis.Key (String), CamelRedis.Value (Object) |Long
+
+|`LLEN` |Get the length of a list |CamelRedis.Key (String) |Long
+
+|`LRANGE` |Get a range of elements from a list |CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long) |List<Object>
+
+|`LTRIM` |Trim a list to the specified range |CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long) |void
+
+|`LINDEX` |Get an element from a list by its index |CamelRedis.Key (String), CamelRedis.Index (Long) |String
+
+|`LINSERT` |Insert an element before or after another element in a list |CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Pivot
+(String), CamelRedis.Position (String) |Long
+
+|`LSET` |Set the value of an element in a list by its index |CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Index
+(Long) |void
+
+|`LREM` |Remove elements from a list |CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Count
+(Long) |Long
+
+|`LPOP` |Remove and get the first element in a list |CamelRedis.Key (String) |Object
+
+|`RPOP` |Remove and get the last element in a list |CamelRedis.Key (String) |String
+
+|`RPOPLPUSH` |Remove the last element in a list, append it to another list and return
+it |CamelRedis.Key (String), CamelRedis.Destination (String) |Object
+
+|`BRPOPLPUSH` |Pop a value from a list, push it to another list and return it; or block
+until one is available |CamelRedis.Key (String), CamelRedis.Destination (String),
+CamelRedis.Timeout (Long) |Object
+
+|`BLPOP` |Remove and get the first element in a list, or block until one is
+available |CamelRedis.Key (String), CamelRedis.Timeout (Long) |Object
+
+|`BRPOP` |Remove and get the last element in a list, or block until one is
+available |CamelRedis.Key (String), CamelRedis.Timeout (Long) |String
+|=======================================================================
+
+[width="100%",cols="20%,20%,20%,60%",options="header",]
+|=======================================================================
+|Set Commands |Description |Parameters |Result
+
+|`SADD` |Add one or more members to a set |CamelRedis.Key (String), CamelRedis.Value (Object) |Boolean
+
+|`SMEMBERS` |Get all the members in a set |CamelRedis.Key (String) |Set<Object>
+
+|`SREM` |Remove one or more members from a set |CamelRedis.Key (String), CamelRedis.Value (Object) |Boolean
+
+|`SPOP` |Remove and return a random member from a set |CamelRedis.Key (String) |String
+
+|`SMOVE` |Move a member from one set to another |CamelRedis.Key (String), CamelRedis.Value (Object),
+CamelRedis.Destination (String) |Boolean
+
+|`SCARD` |Get the number of members in a set |CamelRedis.Key (String) |Long
+
+|`SISMEMBER` |Determine if a given value is a member of a set |CamelRedis.Key (String), CamelRedis.Value (Object) |Boolean
+
+|`SINTER` |Intersect multiple sets |CamelRedis.Key (String), CamelRedis.Keys (String) |Set<Object>
+
+|`SINTERSTORE` |Intersect multiple sets and store the resulting set in a key |CamelRedis.Key (String), CamelRedis.Keys (String),
+CamelRedis.Destination (String) |void
+
+|`SUNION` |Add multiple sets |CamelRedis.Key (String), CamelRedis.Keys (String) |Set<Object>
+
+|`SUNIONSTORE` |Add multiple sets and store the resulting set in a key |CamelRedis.Key (String), CamelRedis.Keys (String),
+CamelRedis.Destination (String) |void
+
+|`SDIFF` |Subtract multiple sets |CamelRedis.Key (String), CamelRedis.Keys (String) |Set<Object>
+
+|`SDIFFSTORE` |Subtract multiple sets and store the resulting set in a key |CamelRedis.Key (String), CamelRedis.Keys (String),
+CamelRedis.Destination (String) |void
+
+|`SRANDMEMBER` |Get one or multiple random members from a set |CamelRedis.Key (String) |String
+|=======================================================================
+
+[width="100%",cols="20%,20%,20%,60%",options="header",]
+|=======================================================================
+|Ordered set Commands |Description |Parameters |Result
+
+|`ZADD` |Add one or more members to a sorted set, or update its score if it
+already exists |CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Score
+(Double) |Boolean
+
+|`ZRANGE` |Return a range of members in a sorted set, by index |CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long),
+CamelRedis.WithScore (Boolean) |Object
+
+|`ZREM` |Remove one or more members from a sorted set |CamelRedis.Key (String), CamelRedis.Value (Object) |Boolean
+
+|`ZINCRBY` |Increment the score of a member in a sorted set |CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Increment
+(Double) |Double
+
+|`ZRANK` |Determine the index of a member in a sorted set |CamelRedis.Key (String), CamelRedis.Value (Object) |Long
+
+|`ZREVRANK` |Determine the index of a member in a sorted set, with scores ordered
+from high to low |CamelRedis.Key (String), CamelRedis.Value (Object) |Long
+
+|`ZREVRANGE` |Return a range of members in a sorted set, by index, with scores ordered
+from high to low |CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long),
+CamelRedis.WithScore (Boolean) |Object
+
+|`ZCARD` |Get the number of members in a sorted set |CamelRedis.Key (String) |Long
+
+|`ZCOUNT` |Count the members in a sorted set with scores within the given values |CamelRedis.Key (String), CamelRedis.Min (Double), CamelRedis.Max
+(Double) |Long
+
+|`ZRANGEBYSCORE` |Return a range of members in a sorted set, by score |CamelRedis.Key (String), CamelRedis.Min (Double), CamelRedis.Max
+(Double) |Set<Object>
+
+|`ZREVRANGEBYSCORE` |Return a range of members in a sorted set, by score, with scores ordered
+from high to low |CamelRedis.Key (String), CamelRedis.Min (Double), CamelRedis.Max
+(Double) |Set<Object>
+
+|`ZREMRANGEBYRANK` |Remove all members in a sorted set within the given indexes |CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long) |void
+
+|`ZREMRANGEBYSCORE` |Remove all members in a sorted set within the given scores |CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long) |void
+
+|`ZUNIONSTORE` |Add multiple sorted sets and store the resulting sorted set in a new key |CamelRedis.Key (String), CamelRedis.Keys (String),
+CamelRedis.Destination (String) |void
+
+|`ZINTERSTORE` |Intersect multiple sorted sets and store the resulting sorted set in a
+new key |CamelRedis.Key (String), CamelRedis.Keys (String),
+CamelRedis.Destination (String) |void
+|=======================================================================
+
+[width="100%",cols="20%,20%,20%,60%",options="header",]
+|=======================================================================
+|String Commands |Description |Parameters |Result
+
+|`SET` |Set the string value of a key |CamelRedis.Key (String), CamelRedis.Value (Object) |void
+
+|`GET` |Get the value of a key |CamelRedis.Key (String) |Object
+
+|`STRLEN` |Get the length of the value stored in a key |CamelRedis.Key (String) |Long
+
+|`APPEND` |Append a value to a key |CamelRedis.Key (String), CamelRedis.Value (String) |Integer
+
+|`SETBIT` |Sets or clears the bit at offset in the string value stored at key |CamelRedis.Key (String), CamelRedis.Offset (Long), CamelRedis.Value
+(Boolean) |void
+
+|`GETBIT` |Returns the bit value at offset in the string value stored at key |CamelRedis.Key (String), CamelRedis.Offset (Long) |Boolean
+
+|`SETRANGE` |Overwrite part of a string at key starting at the specified offset |CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Offset
+(Long) |void
+
+|`GETRANGE` |Get a substring of the string stored at a key |CamelRedis.Key (String), CamelRedis.Start (Long), CamelRedis.End (Long) |String
+
+|`SETNX` |Set the value of a key, only if the key does not exist |CamelRedis.Key (String), CamelRedis.Value (Object) |Boolean
+
+|`SETEX` |Set the value and expiration of a key |CamelRedis.Key (String), CamelRedis.Value (Object), CamelRedis.Timeout
+(Long), SECONDS |void
+
+|`DECRBY` |Decrement the integer value of a key by the given number |CamelRedis.Key (String), CamelRedis.Value (Long) |Long
+
+|`DECR` |Decrement the integer value of a key by one |CamelRedis.Key (String), |Long
+
+|`INCRBY` |Increment the integer value of a key by the given amount |CamelRedis.Key (String), CamelRedis.Value (Long) |Long
+
+|`INCR` |Increment the integer value of a key by one |CamelRedis.Key (String) |Long
+
+|`MGET` |Get the values of all the given keys |CamelRedis.Fields (Collection<String>) |List<Object>
+
+|`MSET` |Set multiple keys to multiple values |CamelRedis.Values(Map<String, Object>) |void
+
+|`MSETNX` |Set multiple keys to multiple values, only if none of the keys exist |CamelRedis.Key (String), CamelRedis.Value (Object) |void
+
+|`GETSET` |Set the string value of a key and return its old value |CamelRedis.Key (String), CamelRedis.Value (Object) |Object
+|=======================================================================
+
+[width="100%",cols="20%,20%,20%,60%",options="header",]
+|=======================================================================
+|Key Commands |Description |Parameters |Result
+
+|`EXISTS` |Determine if a key exists |CamelRedis.Key (String) |Boolean
+
+|`DEL` |Delete a key |CamelRedis.Keys (String) |void
+
+|`TYPE` |Determine the type stored at key |CamelRedis.Key (String) |DataType
+
+|`KEYS` |Find all keys matching the given pattern |CamelRedis.Pattern (String) |Collection<String>
+
+|`RANDOMKEY` |Return a random key from the keyspace |CamelRedis.Pattern (String), CamelRedis.Value (String) |String
+
+|`RENAME` |Rename a key |CamelRedis.Key (String) |void
+
+|`RENAMENX` |Rename a key, only if the new key does not exist |CamelRedis.Key (String), CamelRedis.Value (String) |Boolean
+
+|`EXPIRE` |Set a key's time to live in seconds |CamelRedis.Key (String), CamelRedis.Timeout (Long) |Boolean
+
+|`SORT` |Sort the elements in a list, set or sorted set |CamelRedis.Key (String) |List<Object>
+
+|`PERSIST` |Remove the expiration from a key |CamelRedis.Key (String) |Boolean
+
+|`EXPIREAT` |Set the expiration for a key as a UNIX timestamp |CamelRedis.Key (String), CamelRedis.Timestamp (Long) |Boolean
+
+|`PEXPIRE` |Set a key's time to live in milliseconds |CamelRedis.Key (String), CamelRedis.Timeout (Long) |Boolean
+
+|`PEXPIREAT` |Set the expiration for a key as a UNIX timestamp specified in
+milliseconds |CamelRedis.Key (String), CamelRedis.Timestamp (Long) |Boolean
+
+|`TTL` |Get the time to live for a key |CamelRedis.Key (String) |Long
+
+|`MOVE` |Move a key to another database |CamelRedis.Key (String), CamelRedis.Db (Integer) |Boolean
+|=======================================================================
+
+[width="100%",cols="20%,20%,20%,60%",options="header",]
+|=======================================================================
+|Other Command |Description |Parameters |Result
+
+|`MULTI` |Mark the start of a transaction block |none |void
+
+|`DISCARD` |Discard all commands issued after MULTI |none |void
+
+|`EXEC` |Execute all commands issued after MULTI |none |void
+
+|`WATCH` |Watch the given keys to determine execution of the MULTI/EXEC block |CamelRedis.Keys (String) |void
+
+|`UNWATCH` |Forget about all watched keys |none |void
+
+|`ECHO` |Echo the given string |CamelRedis.Value (String) |String
+
+|`PING` |Ping the server |none |String
+
+|`QUIT` |Close the connection |none |void
+
+|`PUBLISH` |Post a message to a channel |CamelRedis.Channel (String), CamelRedis.Message (Object) |void
+|=======================================================================
+
+[[SpringRedis-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+Maven users will need to add the following dependency to their pom.xml.
+
+*pom.xml*
+
+[source,xml]
+-----------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-spring-redis</artifactId>
+    <version>${camel-version}</version>
+</dependency>
+-----------------------------------------------
+
+where `${camel-version`} must be replaced by the actual version of Camel
+(2.11 or higher).
+
+[[SpringRedis-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/438273db/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 84796e7..7639688 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -252,6 +252,7 @@
     * [Spring-Integration](spring-integration.adoc)
     * [Spring-Javaconfig](spring-java-config.adoc)
     * [Spring-Ldap](spring-ldap.adoc)
+    * [Spring-Redis](spring-redis.adoc)
     * [Telegram](telegram.adoc)
     * [Twitter](twitter.adoc)
     * [Websocket](websocket.adoc)


[2/3] camel git commit: Added camel-spring-security docs to Gitbook

Posted by ac...@apache.org.
Added camel-spring-security docs to Gitbook


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

Branch: refs/heads/master
Commit: 48f129cfd6786e2eb50395f7e75edd9b6e1e556c
Parents: 438273d
Author: Andrea Cosentino <an...@gmail.com>
Authored: Wed Jun 8 13:22:38 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed Jun 8 13:38:00 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/spring-security.adoc          | 217 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 218 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/48f129cf/components/camel-spring-security/src/main/docs/spring-security.adoc
----------------------------------------------------------------------
diff --git a/components/camel-spring-security/src/main/docs/spring-security.adoc b/components/camel-spring-security/src/main/docs/spring-security.adoc
new file mode 100644
index 0000000..f3f3e8f
--- /dev/null
+++ b/components/camel-spring-security/src/main/docs/spring-security.adoc
@@ -0,0 +1,217 @@
+[[SpringSecurity-SpringSecurity]]
+Spring Security
+~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.3*
+
+The *camel-spring-security* component provides role-based authorization
+for Camel routes. It leverages the authentication and user services
+provided by
+http://static.springsource.org/spring-security/site/index.html[Spring
+Security] (formerly Acegi Security) and adds a declarative, role-based
+policy system to control whether a route can be executed by a given
+principal.
+
+If you are not familiar with the Spring Security authentication and
+authorization system, please review the current reference documentation
+on the SpringSource web site linked above.
+
+[[SpringSecurity-Creatingauthorizationpolicies]]
+Creating authorization policies
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Access to a route is controlled by an instance of a
+`SpringSecurityAuthorizationPolicy` object. A policy object contains the
+name of the Spring Security authority (role) required to run a set of
+endpoints and references to Spring Security `AuthenticationManager` and
+`AccessDecisionManager` objects used to determine whether the current
+principal has been assigned that role. Policy objects may be configured
+as Spring beans or by using an `<authorizationPolicy>` element in Spring
+XML.
+
+The `<authorizationPolicy>` element may contain the following
+attributes:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Default Value |Description
+
+|`id` |`null` |The unique Spring bean identifier which is used to reference the policy
+in routes (required)
+
+|`access` |`null` |The Spring Security authority name that is passed to the access decision
+manager (required)
+
+|`authenticationManager` |`authenticationManager` |The name of the Spring Security `AuthenticationManager` object in the
+context
+
+|`accessDecisionManager` |`accessDecisionManager` |The name of the Spring Security `AccessDecisionManager` object in the
+context
+
+|`authenticationAdapter` |DefaultAuthenticationAdapter |*Camel 2.4* The name of a *camel-spring-security*
+`AuthenticationAdapter` object in the context that is used to convert a
+`javax.security.auth.Subject` into a Spring Security `Authentication`
+instance.
+
+|`useThreadSecurityContext` |`true` |If a `javax.security.auth.Subject` cannot be found in the In message
+header under Exchange.AUTHENTICATION, check the Spring Security
+`SecurityContextHolder` for an `Authentication` object.
+
+|`alwaysReauthenticate` |`false` |If set to true, the `SpringSecurityAuthorizationPolicy` will always call
+`AuthenticationManager.authenticate()` each time the policy is accessed.
+|=======================================================================
+
+[[SpringSecurity-ControllingaccesstoCamelroutes]]
+Controlling access to Camel routes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A Spring Security `AuthenticationManager` and `AccessDecisionManager`
+are required to use this component. Here is an example of how to
+configure these objects in Spring XML using the Spring Security
+namespace:
+
+Now that the underlying security objects are set up, we can use them to
+configure an authorization policy and use that policy to control access
+to a route:
+
+In this example, the endpoint `mock:end` will not be executed unless a
+Spring Security `Authentication` object that has been or can be
+authenticated and contains the `ROLE_ADMIN` authority can be located by
+the _admin_ `SpringSecurityAuthorizationPolicy`.
+
+[[SpringSecurity-Authentication]]
+Authentication
+^^^^^^^^^^^^^^
+
+The process of obtaining security credentials that are used for
+authorization is not specified by this component. You can write your own
+processors or components which get authentication information from the
+exchange depending on your needs. For example, you might create a
+processor that gets credentials from an HTTP request header originating
+in the link:jetty.html[Jetty] component. No matter how the credentials
+are collected, they need to be placed in the In message or the
+`SecurityContextHolder` so the Camel link:spring-security.html[Spring
+Security] component can access them:
+
+[source,java]
+----------------------------------------------------------------------------------------------------------------------
+import javax.security.auth.Subject;
+import org.apache.camel.*;
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.security.authentication.*;
+
+
+public class MyAuthService implements Processor {
+    public void process(Exchange exchange) throws Exception {
+        // get the username and password from the HTTP header
+        // http://en.wikipedia.org/wiki/Basic_access_authentication
+        String userpass = new String(Base64.decodeBase64(exchange.getIn().getHeader("Authorization", String.class)));
+        String[] tokens = userpass.split(":");
+        
+        // create an Authentication object
+        UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(tokens[0], tokens[1]);
+
+        // wrap it in a Subject
+        Subject subject = new Subject();
+        subject.getPrincipals().add(authToken);
+
+        // place the Subject in the In message
+        exchange.getIn().setHeader(Exchange.AUTHENTICATION, subject);
+
+        // you could also do this if useThreadSecurityContext is set to true
+        // SecurityContextHolder.getContext().setAuthentication(authToken);
+    }
+}
+----------------------------------------------------------------------------------------------------------------------
+
+The `SpringSecurityAuthorizationPolicy` will automatically authenticate
+the `Authentication` object if necessary.
+
+There are two issues to be aware of when using the
+`SecurityContextHolder` instead of or in addition to the
+`Exchange.AUTHENTICATION` header. First, the context holder uses a
+thread-local variable to hold the `Authentication` object. Any routes
+that cross thread boundaries, like *seda* or *jms*, will lose the
+`Authentication` object. Second, the Spring Security system appears to
+expect that an `Authentication` object in the context is already
+authenticated and has roles (see the Technical Overview
+http://static.springsource.org/spring-security/site/docs/3.0.x/reference/technical-overview.html#tech-intro-authentication[section
+5.3.1] for more details).
+
+The default behavior of *camel-spring-security* is to look for a
+`Subject` in the `Exchange.AUTHENTICATION` header. This `Subject` must
+contain at least one principal, which must be a subclass of
+`org.springframework.security.core.Authentication`. You can customize
+the mapping of `Subject` to `Authentication` object by providing an
+implementation of the
+`org.apache.camel.component.spring.security.AuthenticationAdapter` to
+your `<authorizationPolicy>` bean. This can be useful if you are working
+with components that do not use Spring Security but do provide a
+`Subject`. At this time, only the link:cxf.html[CXF] component populates
+the `Exchange.AUTHENTICATION` header.
+
+[[SpringSecurity-Handlingauthenticationandauthorizationerrors]]
+Handling authentication and authorization errors
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If authentication or authorization fails in the
+`SpringSecurityAuthorizationPolicy`, a `CamelAuthorizationException`
+will be thrown. This can be handled using Camel's standard exception
+handling methods, like the link:exception-clause.html[Exception Clause].
+The `CamelAuthorizationException` will have a reference to the ID of the
+policy which threw the exception so you can handle errors based on the
+policy as well as the type of exception:
+
+[source,xml]
+------------------------------------------------------------------------------------------
+<onException>
+  <exception>org.springframework.security.authentication.AccessDeniedException</exception>
+  <choice>
+    <when>
+      <simple>${exception.policyId} == 'user'</simple>
+      <transform>
+        <constant>You do not have ROLE_USER access!</constant>
+      </transform>
+    </when>
+    <when>
+      <simple>${exception.policyId} == 'admin'</simple>
+      <transform>
+        <constant>You do not have ROLE_ADMIN access!</constant>
+      </transform>
+    </when>
+  </choice>
+</onException>
+------------------------------------------------------------------------------------------
+
+[[SpringSecurity-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+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-spring-security</artifactId> 
+  <version>2.4.0</version> 
+</dependency> 
+-------------------------------------------------
+
+This dependency will also pull in
+`org.springframework.security:spring-security-core:3.0.3.RELEASE` and
+`org.springframework.security:spring-security-config:3.0.3.RELEASE`.
+
+[[SpringSecurity-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+
+* link:components.html[Components]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/48f129cf/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 7639688..d698754 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -253,6 +253,7 @@
     * [Spring-Javaconfig](spring-java-config.adoc)
     * [Spring-Ldap](spring-ldap.adoc)
     * [Spring-Redis](spring-redis.adoc)
+    * [Spring-Security](spring-security.adoc)
     * [Telegram](telegram.adoc)
     * [Twitter](twitter.adoc)
     * [Websocket](websocket.adoc)