camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klaus777 <max.bridgewa...@gmail.com>
Subject Camel + RESTLET in Tomcat/Jetty
Date Wed, 02 Oct 2013 17:46:20 GMT
As far as I understand, Camel by default uses the default RESTLET engine. How
can I tell Camel to use Jetty for RESTLEY instead?

I know there are ways to bundle an application and deploy it in Tomcat or
Jetty. If I do that, however, the biggest question becomes how to integrate
with RESTLET.

I did some digging. I took one of the tomcat examples that come with camel.
Then I tried to make deploy the RESTLET servlet. It almost works. 
My Spring Camel configuration is given below as well as my web.xml. The
problem now is that the parameters are not being passed to the route. I
would expect that when calling this server:
http://localhost:8080/rs/user/?name=Paul, I would get: Hello Paul how are
you?

Instead, I simply get: Hello how are you?
PS: The container is Tomcat.

Camel Spring config:
 <camelContext xmlns="http://camel.apache.org/schema/spring">

   <route>
   	<from uri="restlet:/user/?restletMethods=GET,POST"/>
   	  <transform>
            <simple>Hello ${header.name} how are you?</simple>
          </transform>
   </route>
  </camelContext>
<bean id="RestletComponent" class="org.restlet.Component"/>
<bean id="RestletComponentService"
class="org.apache.camel.component.restlet.RestletComponent">
   <constructor-arg index="0">
     <ref bean="RestletComponent"/>
   </constructor-arg>
</bean> 

Web.xml:
<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:camel-config.xml</param-value>
	</context-param>
	<listener>
	
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<servlet>
		<servlet-name>RestletServlet</servlet-name>
		<servlet-class>org.restlet.ext.spring.SpringServerServlet</servlet-class>
		<init-param>
			<param-name>org.restlet.component</param-name>
			<param-value>RestletComponent</param-value>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>RestletServlet</servlet-name>
		<url-pattern>/rs/*</url-pattern>
	</servlet-mapping>



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-RESTLET-in-Tomcat-Jetty-tp5740778.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message