org.apache.xmlrpc.server
Class XmlRpcStreamServer

java.lang.Object
  extended by org.apache.xmlrpc.common.XmlRpcController
      extended by org.apache.xmlrpc.server.XmlRpcServer
          extended by org.apache.xmlrpc.server.XmlRpcStreamServer
Direct Known Subclasses:
ConnectionServer, XmlRpcServletServer

public abstract class XmlRpcStreamServer
extends XmlRpcServer

Extension of XmlRpcServer with support for reading requests from a stream and writing the response to another stream.


Constructor Summary
XmlRpcStreamServer()
           
 
Method Summary
protected abstract  void closeConnection(java.lang.Object pConnection)
          Closes the connection, releasing all resources.
 void execute(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection)
          Returns, whether the /** Processes a "connection".
protected  java.io.InputStream getInputStream(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection)
           
protected  java.io.OutputStream getOutputStream(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection, int pSize)
          Called to prepare the output stream, if content length is required.
protected  java.io.OutputStream getOutputStream(XmlRpcStreamRequestConfig pConfig, java.io.OutputStream pStream)
          Called to prepare the output stream.
protected  XmlRpcRequest getRequest(XmlRpcStreamRequestConfig pConfig, java.io.InputStream pStream)
           
protected  XmlRpcWriter getXmlRpcWriter(XmlRpcStreamRequestConfig pConfig, java.io.OutputStream pStream)
           
 XmlWriterFactory getXMLWriterFactory()
          Returns the XML Writer factory.
protected  boolean isContentLengthRequired(XmlRpcStreamRequestConfig pConfig)
          Returns, whether the requests content length is required.
protected abstract  java.io.InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection)
          Returns the connections input stream.
protected abstract  java.io.OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection)
          Creates the connections output stream.
 void setXMLWriterFactory(XmlWriterFactory pFactory)
          Sets the XML Writer factory.
protected  void writeError(XmlRpcStreamRequestConfig pConfig, java.io.OutputStream pStream, java.lang.Throwable pError)
           
protected  void writeResponse(XmlRpcStreamRequestConfig pConfig, java.io.OutputStream pStream, java.lang.Object pResult)
           
 
Methods inherited from class org.apache.xmlrpc.server.XmlRpcServer
execute, getConfig, getDefaultXmlRpcWorkerFactory, getHandlerMapping, setConfig, setHandlerMapping
 
Methods inherited from class org.apache.xmlrpc.common.XmlRpcController
getMaxThreads, getTypeFactory, getWorkerFactory, setMaxThreads, setTypeFactory, setWorkerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcStreamServer

public XmlRpcStreamServer()
Method Detail

getRequest

protected XmlRpcRequest getRequest(XmlRpcStreamRequestConfig pConfig,
                                   java.io.InputStream pStream)
                            throws XmlRpcException
Throws:
XmlRpcException

getXmlRpcWriter

protected XmlRpcWriter getXmlRpcWriter(XmlRpcStreamRequestConfig pConfig,
                                       java.io.OutputStream pStream)
                                throws XmlRpcException
Throws:
XmlRpcException

writeResponse

protected void writeResponse(XmlRpcStreamRequestConfig pConfig,
                             java.io.OutputStream pStream,
                             java.lang.Object pResult)
                      throws XmlRpcException
Throws:
XmlRpcException

writeError

protected void writeError(XmlRpcStreamRequestConfig pConfig,
                          java.io.OutputStream pStream,
                          java.lang.Throwable pError)
                   throws XmlRpcException
Throws:
XmlRpcException

setXMLWriterFactory

public void setXMLWriterFactory(XmlWriterFactory pFactory)
Sets the XML Writer factory.

Parameters:
pFactory - The XML Writer factory.

getXMLWriterFactory

public XmlWriterFactory getXMLWriterFactory()
Returns the XML Writer factory.

Returns:
The XML Writer factory.

newInputStream

protected abstract java.io.InputStream newInputStream(XmlRpcStreamRequestConfig pConfig,
                                                      java.lang.Object pConnection)
                                               throws java.io.IOException
Returns the connections input stream.

Throws:
java.io.IOException

getInputStream

protected java.io.InputStream getInputStream(XmlRpcStreamRequestConfig pConfig,
                                             java.lang.Object pConnection)
                                      throws java.io.IOException
Throws:
java.io.IOException

newOutputStream

protected abstract java.io.OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig,
                                                        java.lang.Object pConnection)
                                                 throws java.io.IOException
Creates the connections output stream.

Throws:
java.io.IOException

getOutputStream

protected java.io.OutputStream getOutputStream(XmlRpcStreamRequestConfig pConfig,
                                               java.io.OutputStream pStream)
                                        throws java.io.IOException
Called to prepare the output stream. Typically used for enabling compression, or similar filters.

Throws:
java.io.IOException

getOutputStream

protected java.io.OutputStream getOutputStream(XmlRpcStreamRequestConfig pConfig,
                                               java.lang.Object pConnection,
                                               int pSize)
                                        throws java.io.IOException
Called to prepare the output stream, if content length is required.

Throws:
java.io.IOException

isContentLengthRequired

protected boolean isContentLengthRequired(XmlRpcStreamRequestConfig pConfig)
Returns, whether the requests content length is required.


closeConnection

protected abstract void closeConnection(java.lang.Object pConnection)
                                 throws java.io.IOException
Closes the connection, releasing all resources.

Throws:
java.io.IOException

execute

public void execute(XmlRpcStreamRequestConfig pConfig,
                    java.lang.Object pConnection)
             throws java.io.IOException,
                    XmlRpcException
Returns, whether the /** Processes a "connection". The "connection" is an opaque object, which is being handled by the subclasses.

Parameters:
pConfig - The request configuration.
pConnection - The "connection" being processed.
Throws:
XmlRpcException - Processing the request failed.
java.io.IOException - An I/O error occurred.


Copyright 2001-2001-2006 Apache Software Foundation. All Rights Reserved.