redstone.xmlrpc
Class XmlRpcServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by redstone.xmlrpc.XmlRpcServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class XmlRpcServlet
extends javax.servlet.http.HttpServlet

Servlet that publishes an XmlRpcServer in a web server.

Author:
Greger Olsson
See Also:
Serialized Form

Constructor Summary
XmlRpcServlet()
           
 
Method Summary
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.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(javax.servlet.ServletConfig config)
          Initializes the servlet by instantiating the XmlRpcServer that will hold all invocation handlers and processors.
 
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

XmlRpcServlet

public XmlRpcServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.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).

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.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(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res)
            throws javax.servlet.ServletException,
                   java.io.IOException
Handles reception of XML-RPC messages.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
req -
res -
Throws:
javax.servlet.ServletException
java.io.IOException