org.apache.cayenne.remote.hessian.service
Class HessianServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by org.apache.cayenne.remote.hessian.service.HessianServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class HessianServlet
extends javax.servlet.GenericServlet

An extension of the com.caucho.hessian.server.HessianServlet that installs default Cayenne handlers, simplifying web.xml configuration. Here is a sample configuration:

        <servlet>
          <servlet-name>cayenne</servlet-name>
          <servlet-class>org.apache.cayenne.remote.hessian.service.HessianServlet</servlet-class>
        </servlet>
                        
        <servlet-mapping>
          <servlet-name>cayenne</servlet-name>
          <url-pattern>/cayenne</url-pattern>
        </servlet-mapping>
 
Custom service class and interface can be specified in a manner compatible with Hessian recommendations, namely via service-class and api-class servlet parameters.

Since:
1.2
Author:
Andrus Adamchik
See Also:
Serialized Form

Constructor Summary
HessianServlet()
           
 
Method Summary
protected  java.lang.Class createAPIClass(javax.servlet.ServletConfig config)
           
protected  HessianService createService(javax.servlet.ServletConfig config)
           
 java.lang.Class getAPIClass()
          Gets the api-class.
 com.caucho.hessian.io.SerializerFactory getSerializerFactory()
          Gets the serializer factory.
 java.lang.String getServletInfo()
           
 void init(javax.servlet.ServletConfig config)
          Installs HessianService to respond to RemoteService requests.
 void service(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          Execute a request.
 void setAPIClass(java.lang.Class api)
          Sets the api-class.
 void setHome(java.lang.Object home)
          Sets the home implementation
 void setHomeAPI(java.lang.Class api)
          Sets the home api.
 void setObject(java.lang.Object object)
          Sets the object implementation
 void setObjectAPI(java.lang.Class api)
          Sets the object api.
 void setSendCollectionType(boolean sendType)
          Sets the serializer send collection java type.
 void setSerializerFactory(com.caucho.hessian.io.SerializerFactory factory)
          Sets the serializer factory.
 void setService(java.lang.Object service)
          Sets the service class.
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HessianServlet

public HessianServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Installs HessianService to respond to RemoteService requests.

Specified by:
init in interface javax.servlet.Servlet
Throws:
javax.servlet.ServletException

createService

protected HessianService createService(javax.servlet.ServletConfig config)
                                throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

createAPIClass

protected java.lang.Class createAPIClass(javax.servlet.ServletConfig config)
                                  throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

getServletInfo

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

setHomeAPI

public void setHomeAPI(java.lang.Class api)
Sets the home api.


setHome

public void setHome(java.lang.Object home)
Sets the home implementation


setObjectAPI

public void setObjectAPI(java.lang.Class api)
Sets the object api.


setObject

public void setObject(java.lang.Object object)
Sets the object implementation


setService

public void setService(java.lang.Object service)
Sets the service class.


setAPIClass

public void setAPIClass(java.lang.Class api)
Sets the api-class.


getAPIClass

public java.lang.Class getAPIClass()
Gets the api-class.


setSerializerFactory

public void setSerializerFactory(com.caucho.hessian.io.SerializerFactory factory)
Sets the serializer factory.


getSerializerFactory

public com.caucho.hessian.io.SerializerFactory getSerializerFactory()
Gets the serializer factory.


setSendCollectionType

public void setSendCollectionType(boolean sendType)
Sets the serializer send collection java type.


service

public void service(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Execute a request. The path-info of the request selects the bean. Once the bean's selected, it will be applied.

Specified by:
service in interface javax.servlet.Servlet
Specified by:
service in class javax.servlet.GenericServlet
Throws:
java.io.IOException
javax.servlet.ServletException


Copyright © 2001-2006 Apache.org All Rights Reserved.