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 java.lang.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:


Constructor Summary
CamelServlet(org.apache.camel.CamelContext camelContext, java.lang.String camelDestination)
          Creates a new CamelServlet instance.
CamelServlet(org.apache.camel.CamelContext camelContext, java.lang.String camelDestination, java.lang.String defaultFileName)
          Creates a new CamelServlet instance.
 
Method Summary
 void destroy()
           
 javax.servlet.ServletConfig getServletConfig()
           
 java.lang.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
 

Constructor Detail

CamelServlet

public CamelServlet(org.apache.camel.CamelContext camelContext,
                    java.lang.String camelDestination,
                    java.lang.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,
                    java.lang.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,
                    java.io.IOException
Specified by:
service in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException
java.io.IOException

getServletInfo

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

destroy

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



Copyright © 2010 OW2 Consortium. All Rights Reserved.
Apache Camel version 2.5.0, OW2 JOnAS version 5.2.0-M3