com.metaparadigm.jsonrpc
Class JSONRPCServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.metaparadigm.jsonrpc.JSONRPCServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class JSONRPCServlet
extends javax.servlet.http.HttpServlet

This servlet handles JSON-RPC requests over HTTP and hands them to a JSONRPCBridge instance registered in the HttpSession.

By default, the JSONRPCServlet places an instance of the JSONRPCBridge object is automatically in the HttpSession object registered under the attribute "JSONRPCBridge".

The following can be added to your web.xml to export the servlet under the URI "/JSON-RPC"

 <servlet>
   <servlet-name>com.metaparadigm.jsonrpc.JSONRPCServlet</servlet-name>
   <servlet-class>com.metaparadigm.jsonrpc.JSONRPCServlet</servlet-class>
 </servlet>
 <servlet-mapping>
   <servlet-name>com.metaparadigm.jsonrpc.JSONRPCServlet</servlet-name>
   <url-pattern>/JSON-RPC</url-pattern>
 </servlet-mapping>
 

You can disable the automatic creation of a JSONRPCBridge in the session by placing the XML below into your web.xml inside the <servlet> element. If you do this, you can add one to the session yourself. If it is disabled, and you have not added one to the session, only the global bridge will be available.

 <init-param>
   <param-name>auto-session-bridge</param-name>
   <param-value>0</param-value>
 </init-param>
 
To disable keepalives to workaround issues with certain web containers and configurations of apache / connectors place the following XML into your web.xml inside the <servlet> element.

 <init-param>
   <param-name>keepalive</param-name>
   <param-value>0</param-value>
 </init-param>
 

See Also:
Serialized Form

Constructor Summary
JSONRPCServlet()
           
 
Method Summary
 void init(javax.servlet.ServletConfig config)
           
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONRPCServlet

public JSONRPCServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.io.IOException,
                    java.lang.ClassCastException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
java.io.IOException
java.lang.ClassCastException


Copyright © 2005 Metaparadigm Pte Ltd.