com.ibm.websphere.rpcadapter
Class RPCAdapter

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.ibm.websphere.rpcadapter.RPCAdapter
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class RPCAdapter
extends javax.servlet.http.HttpServlet
implements javax.servlet.Servlet

Implements RPC access to registered Beans. Supported access protocols include HTTP-RPC and JSON-RPC. Include this Servlet in your web.xml file, then register the Beans as init parms (see the init method). The deployed RPC Adapter exposes the following directory of URLs:

    GET <baseUrl>/httprpc -- directory of registered services
    GET <baseUrl>/httprpc/<serviceName> -- list of operations on <serviceName>
  
    GET  <baseUrl>/httprpc/<serviceName>/<operation>[?name=value] -- HTTP RPC invocation
    POST <baseUrl>/httprpc/<serviceName>/<operation> [BODY:  name=value] -- HTTP RPC invocation
  
    GET  <baseUrl>/jsonrpc/<serviceName> -- Dojo SMD file
    POST <baseUrl>/jsonrpc/<serviceName> [BODY:  JSON-RPC request] -- JSON RPC invocation
 

See Also:
Serialized Form

Field Summary
static java.lang.String SESSION_APP_PREFIX
          Beans marked as oneInstancePerUser are placed in users' HttpSessions with names derived by prepending SESSION_PREFIX to the service name.
 
Constructor Summary
RPCAdapter()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp)
          Implements basic documentation responses (/service, /service/<serviceName>, and /jsonrpc/<serviceName>) as well as invoking RPC operations (processService and processJsonrpc) for HTTP GET.
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp)
          Invokes RPC operations (processService and processJsonrpc) for HTTP POST.
 void init(javax.servlet.ServletConfig config)
          Beans are registered with the RPC Adapter as init parms in web.xml.
protected  void putinSession(javax.servlet.http.HttpServletRequest req, java.lang.String serviceName, com.ibm.websphere.rpcadapter.Ejb service)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, service
 

Field Detail

SESSION_APP_PREFIX

public static java.lang.String SESSION_APP_PREFIX
Beans marked as oneInstancePerUser are placed in users' HttpSessions with names derived by prepending SESSION_PREFIX to the service name.

Constructor Detail

RPCAdapter

public RPCAdapter()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Beans are registered with the RPC Adapter as init parms in web.xml. Format:
    <serviceName> = <fullyQualifiedBeanClassName>
 

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

doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse rsp)
              throws javax.servlet.ServletException,
                     java.io.IOException
Implements basic documentation responses (/service, /service/<serviceName>, and /jsonrpc/<serviceName>) as well as invoking RPC operations (processService and processJsonrpc) for HTTP GET.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException - if an RPC operation was registered as a POST but invoked as a GET.
java.io.IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse rsp)
               throws javax.servlet.ServletException,
                      java.io.IOException
Invokes RPC operations (processService and processJsonrpc) for HTTP POST.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException - if an RPC operation was registered as a GET but invoked as a POST.
java.io.IOException

putinSession

protected void putinSession(javax.servlet.http.HttpServletRequest req,
                            java.lang.String serviceName,
                            com.ibm.websphere.rpcadapter.Ejb service)
                     throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException