org.ow2.jonas.camel.component
Class CamelServlet

java.lang.Object
  extended by org.ow2.jonas.camel.component.CamelServlet
All Implemented Interfaces:
javax.servlet.Servlet

public class CamelServlet
extends Object
implements javax.servlet.Servlet

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:


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

ERROR_STATUS_CODE

public static final String ERROR_STATUS_CODE
Error status code ID.

See Also:
Constant Field Values

REQUEST_PROPERTY_NAME

public static final String REQUEST_PROPERTY_NAME
Request property name for the exchange message.

See Also:
Constant Field Values
Constructor Detail

CamelServlet

public CamelServlet(org.apache.camel.CamelContext camelContext,
                    String camelDestination,
                    String defaultFileName)
Creates a new CamelServlet instance.

Parameters:
camelContext - CAMEL context to send messages to.
camelDestination - Name of the CAMEL endpoint on the camelContext
defaultFileName - Default file name to use if the response has no file name.

CamelServlet

public CamelServlet(org.apache.camel.CamelContext camelContext,
                    String camelDestination)
Creates a new CamelServlet instance.

Parameters:
camelContext - CAMEL context to send messages to.
camelDestination - Name of the CAMEL endpoint on the camelContext
Method Detail

init

public void init(javax.servlet.ServletConfig servletConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Specified by:
getServletConfig in interface javax.servlet.Servlet

service

public void service(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse rsp)
             throws javax.servlet.ServletException,
                    IOException
Specified by:
service in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException
IOException

getServletInfo

public String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet


Copyright © 2013 OW2 Consortium. All Rights Reserved.