|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ow2.jonas.camel.component.CamelServlet
public class CamelServlet
Generic CAMEL servlet, that can be for example used for REST endpoints. It
will map all request parameters to the Camel exchange's in message headers.
Note that all servlet headers use ServletRequest.getParameterMap(),
therefore the keys in the parameter map are of type String and the values in
the parameter map are of type String array.
In order to use it:
/myServlet) and an
endpoint name (for example, direct:myServlet).
import org.osgi.service.http.HttpService;
...
HttpService httpService = getService(HttpService.class);
HttpContext httpContext = httpService.createDefaultHttpContext();
Dictionary initParams = new Hashtable();
initParams.put("matchOnUriPrefix", "false");
initParams.put("servlet-name", SERVLET_PATH);
httpService.registerServlet(SERVLET_PATH,
new CamelServlet(this.getContext(), ENDPOINT_NAME),
initParams, httpContext);
this.from(ENDPOINT_NAME).process(new MyProcessor());
| Field Summary | |
|---|---|
static String |
ERROR_STATUS_CODE
Error status code ID. |
static String |
REQUEST_PROPERTY_NAME
Request property name for the exchange message. |
| Constructor Summary | |
|---|---|
CamelServlet(org.apache.camel.CamelContext camelContext,
String camelDestination)
Creates a new CamelServlet instance. |
|
CamelServlet(org.apache.camel.CamelContext camelContext,
String camelDestination,
String defaultFileName)
Creates a new CamelServlet instance. |
|
| Method Summary | |
|---|---|
void |
destroy()
|
javax.servlet.ServletConfig |
getServletConfig()
|
String |
getServletInfo()
|
void |
init(javax.servlet.ServletConfig servletConfig)
|
void |
service(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse rsp)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ERROR_STATUS_CODE
public static final String REQUEST_PROPERTY_NAME
| Constructor Detail |
|---|
public CamelServlet(org.apache.camel.CamelContext camelContext,
String camelDestination,
String defaultFileName)
camelContext - CAMEL context to send messages to.camelDestination - Name of the CAMEL endpoint on the camelContextdefaultFileName - Default file name to use if the response has no
file name.
public CamelServlet(org.apache.camel.CamelContext camelContext,
String camelDestination)
camelContext - CAMEL context to send messages to.camelDestination - Name of the CAMEL endpoint on the camelContext| Method Detail |
|---|
public void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletjavax.servlet.ServletExceptionpublic javax.servlet.ServletConfig getServletConfig()
getServletConfig in interface javax.servlet.Servlet
public void service(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse rsp)
throws javax.servlet.ServletException,
IOException
service in interface javax.servlet.Servletjavax.servlet.ServletException
IOExceptionpublic String getServletInfo()
getServletInfo in interface javax.servlet.Servletpublic void destroy()
destroy in interface javax.servlet.Servlet
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||