Appendix B SAmple Code CamelServlet org.apache.camel.component.servlet. CamelHttpTransportServlet 1 CamelServlet /camel/* listener/listener-class: This element launches the Spring container, as shown in Figure B-14. context-param: This element specifies the location of the Spring XML file, camel- config.xml, in the WAR. The Spring container will read this parameter and load the specified Spring XML file, which contains the definition of the Camel route. servlet/servlet-class: Specifies the org.apache.camel.component.servlet. CamelHttpTransportServlet class, which implements the Camel Servlet component servlet-mapping/url-pattern. It determines which URLs are routed to this servlet. In general, the servlet URL has the following form: http://Host:Port/WARFileName/ URLPattern. Where the base URL, http://Host:Port, is determined by the configuration of the web server, the WARFileName is the root of the WARFileName.war WAR file, and the URLPattern is specified by the contents of the url-pattern element. Assuming that the application server port is set to 8001, the integration.0.0.1application would match URLs of the following form: http:// localhost:8001/integration.0.0.1/camel/*. The Camel route for this example, defined in a Spring XML file in applicationContext. xml, using Camel's XML DSL syntax, is shown in Listing B-2. 350
Building Digital Experience Platforms Page 359 Page 361