redstone.xmlrpc
Class XmlRpcServlet

java.lang.Object
  extended by HttpServlet
      extended by redstone.xmlrpc.XmlRpcServlet

public class XmlRpcServlet
extends HttpServlet

Servlet that publishes an XmlRpcServer in a web server.

Author:
Greger Olsson

Constructor Summary
XmlRpcServlet()
           
 
Method Summary
 void doPost(HttpServletRequest req, HttpServletResponse res)
          Handles reception of XML-RPC messages.
 java.lang.String getContentType()
          Returns the content type of the messages returned from the servlet which is text/xml for XML-RPC messages and text/javascript+json for JSON messages.
 boolean getStreamMessages()
          Indicates whether or not messages are streamed or if they are built in memory to be able to calculate the HTTP Content-Length.
 XmlRpcServer getXmlRpcServer()
          Returns the XmlRpcServer that is backing the servlet.
 void init(ServletConfig config)
          Initializes the servlet by instantiating the XmlRpcServer that will hold all invocation handlers and processors.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcServlet

public XmlRpcServlet()
Method Detail

init

public void init(ServletConfig config)
          throws ServletException
Initializes the servlet by instantiating the XmlRpcServer that will hold all invocation handlers and processors. The servlet configuration is read to see if the XML-RPC responses generated should be streamed immediately to the resonse (non-compliant) or if they should be buffered before being sent (compliant, since then the Content-Length header may be set, as stipulated by the XML-RPC specification).

Further, the configuration is read to see if any services are mentioned declaratively that are to be instantiated and published. An alternative to this is to create a new servlet class extending from XmlRpcServlet that publishes services programmatically.

Throws:
ServletException

getXmlRpcServer

public XmlRpcServer getXmlRpcServer()
Returns the XmlRpcServer that is backing the servlet.

Returns:
The XmlRpcServer backing the servlet.

getStreamMessages

public boolean getStreamMessages()
Indicates whether or not messages are streamed or if they are built in memory to be able to calculate the HTTP Content-Length.

Returns:
True if messages are streamed directly over the socket as it is built.

getContentType

public java.lang.String getContentType()
Returns the content type of the messages returned from the servlet which is text/xml for XML-RPC messages and text/javascript+json for JSON messages.

Returns:
The content type of the messages returned from this servlet.

doPost

public void doPost(HttpServletRequest req,
                   HttpServletResponse res)
            throws ServletException,
                   java.io.IOException
Handles reception of XML-RPC messages.

Parameters:
req -
res -
Throws:
ServletException
java.io.IOException