camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (CAMEL-4175) Enable Restlet servlet to be configured within a webapp
Date Tue, 05 Jul 2011 14:31:16 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-4175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Willem Jiang reassigned CAMEL-4175:
-----------------------------------

    Assignee: Willem Jiang

> Enable Restlet servlet to be configured within a webapp
> -------------------------------------------------------
>
>                 Key: CAMEL-4175
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4175
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-restlet
>    Affects Versions: 2.7.2
>            Reporter: Stu Churchill
>            Assignee: Willem Jiang
>             Fix For: 2.7.3
>
>         Attachments: camel-4175.txt
>
>
> There are three possible ways to configure a Restlet application within a servlet container
(http://www.restlet.org/documentation/2.0/jee/ext/org/restlet/ext/servlet/ServerServlet.html)
and using the subclassed SpringServerServlet enables configuration within Camel by injecting
the Restlet Component - however this is currently only available internally within the Camel
component.
> Use of the Restlet servlet within a servlet container enables routes to be configured
with relative paths in URIs (removing the restrictions of hard-coded absolute URIs) and for
the hosting servlet container to handle incoming requests (rather than have to spawn a separate
server process on a new port).
> To configure, add the following to your camel-context.xml;
>   <camelContext>
>     <route id="RS_RestletDemo">
>       <from uri="restlet:/demo/{id}" />
>       <transform>
>         <simple>Request type : ${header.CamelHttpMethod} and ID : ${header.id}</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>
> And add this to your web.xml;
>   <!-- Restlet Servlet -->
>   <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>
> You will then be able to access the deployed route at http://localhost:8080/mywebapp/rs/demo/1234
where;
>  - localhost:8080 is the server and port of your servlet container
>  - mywebapp is the name of your deployed webapp
> Your browser will then show the following content;
> "Request type : GET and ID : 1234"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message