org.apache.xmlrpc.client
Class XmlRpcCommonsTransport

java.lang.Object
  extended by org.apache.xmlrpc.client.XmlRpcTransportImpl
      extended by org.apache.xmlrpc.client.XmlRpcStreamTransport
          extended by org.apache.xmlrpc.client.XmlRpcHttpTransport
              extended by org.apache.xmlrpc.client.XmlRpcCommonsTransport
All Implemented Interfaces:
XmlRpcTransport

public class XmlRpcCommonsTransport
extends XmlRpcHttpTransport

An HTTP transport factory, which is based on the Jakarta Commons HTTP Client.


Field Summary
 
Fields inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
USER_AGENT
 
Constructor Summary
XmlRpcCommonsTransport(XmlRpcClient pClient)
          Creates a new instance.
 
Method Summary
protected  void closeConnection(java.lang.Object pConnection)
          Closes the connection object.
protected  java.lang.String getUserAgent()
           
protected  boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection)
          Returns, whether the response is gzip compressed.
protected  boolean isUsingByteArrayOutput(XmlRpcStreamRequestConfig pConfig)
          If this method returns true, then the method XmlRpcStreamTransport.newInputStream(XmlRpcStreamRequestConfig, Object, byte[]) will be invoked to create the response.
protected  java.lang.Object newConnection(XmlRpcStreamRequestConfig pConfig)
          Creates the connection object.
protected  java.io.InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection)
          Creates a new input stream for reading the response.
protected  java.io.InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection, byte[] pContents)
          Creates a new input stream for reading the response.
protected  java.io.OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig, java.lang.Object pConnection)
          Creates a new output stream, to which the request may be written.
protected  void setContentLength(java.lang.Object pConnection, int pLength)
           
protected  void setCredentials(XmlRpcHttpClientConfig pConfig, java.lang.Object pConnection)
           
protected  void setRequestHeader(java.lang.Object pConnection, java.lang.String pHeader, java.lang.String pValue)
           
 
Methods inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
getInputStream, initConnection, setCompressionHeaders
 
Methods inherited from class org.apache.xmlrpc.client.XmlRpcStreamTransport
closeInputStream, closeOutputStream, getOutputStream, newXMLReader, readResponse, sendRequest, writeRequest
 
Methods inherited from class org.apache.xmlrpc.client.XmlRpcTransportImpl
getClient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcCommonsTransport

public XmlRpcCommonsTransport(XmlRpcClient pClient)
Creates a new instance.

Parameters:
pClient - The client, which will be invoking the transport.
Method Detail

getUserAgent

protected java.lang.String getUserAgent()
Overrides:
getUserAgent in class XmlRpcHttpTransport

setRequestHeader

protected void setRequestHeader(java.lang.Object pConnection,
                                java.lang.String pHeader,
                                java.lang.String pValue)
Specified by:
setRequestHeader in class XmlRpcHttpTransport

isResponseGzipCompressed

protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig,
                                           java.lang.Object pConnection)
Description copied from class: XmlRpcStreamTransport
Returns, whether the response is gzip compressed.

Specified by:
isResponseGzipCompressed in class XmlRpcHttpTransport
Parameters:
pConfig - The clients configuration.
pConnection - The connection object.
Returns:
Whether the response stream is gzip compressed.

newConnection

protected java.lang.Object newConnection(XmlRpcStreamRequestConfig pConfig)
                                  throws XmlRpcClientException
Description copied from class: XmlRpcStreamTransport
Creates the connection object. The connection object is a factory for output and input stream.

Specified by:
newConnection in class XmlRpcStreamTransport
Throws:
XmlRpcClientException

closeConnection

protected void closeConnection(java.lang.Object pConnection)
                        throws XmlRpcClientException
Description copied from class: XmlRpcStreamTransport
Closes the connection object.

Specified by:
closeConnection in class XmlRpcStreamTransport
Throws:
XmlRpcClientException

newOutputStream

protected java.io.OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig,
                                               java.lang.Object pConnection)
                                        throws XmlRpcClientException
Description copied from class: XmlRpcStreamTransport
Creates a new output stream, to which the request may be written.

Specified by:
newOutputStream in class XmlRpcStreamTransport
Parameters:
pConfig - Client configuration.
pConnection - Connection being used to send request data.
Returns:
Opened output stream.
Throws:
XmlRpcClientException - An error occurred on the client.

isUsingByteArrayOutput

protected boolean isUsingByteArrayOutput(XmlRpcStreamRequestConfig pConfig)
Description copied from class: XmlRpcStreamTransport
If this method returns true, then the method XmlRpcStreamTransport.newInputStream(XmlRpcStreamRequestConfig, Object, byte[]) will be invoked to create the response. Otherwise, the methods XmlRpcStreamTransport.getOutputStream(XmlRpcStreamRequestConfig, Object), and XmlRpcStreamTransport.newInputStream(XmlRpcStreamRequestConfig, Object) will be used.

Overrides:
isUsingByteArrayOutput in class XmlRpcHttpTransport
Returns:
Whether conversion into a byte array is required to create the response.

newInputStream

protected java.io.InputStream newInputStream(XmlRpcStreamRequestConfig pConfig,
                                             java.lang.Object pConnection)
                                      throws XmlRpcException
Description copied from class: XmlRpcStreamTransport
Creates a new input stream for reading the response.

Specified by:
newInputStream in class XmlRpcStreamTransport
Parameters:
pConfig - The clients configuration.
pConnection - The connection object.
Returns:
Opened input stream for reading data.
Throws:
XmlRpcException - Creating the input stream failed.

setContentLength

protected void setContentLength(java.lang.Object pConnection,
                                int pLength)
Overrides:
setContentLength in class XmlRpcHttpTransport

newInputStream

protected java.io.InputStream newInputStream(XmlRpcStreamRequestConfig pConfig,
                                             java.lang.Object pConnection,
                                             byte[] pContents)
                                      throws XmlRpcException
Description copied from class: XmlRpcStreamTransport
Creates a new input stream for reading the response.

Specified by:
newInputStream in class XmlRpcStreamTransport
Parameters:
pConfig - The clients configuration.
pConnection - The connection object.
pContents - A byte array with the response.
Returns:
Opened input stream for reading data.
Throws:
XmlRpcException - Creating the input stream failed.

setCredentials

protected void setCredentials(XmlRpcHttpClientConfig pConfig,
                              java.lang.Object pConnection)
                       throws XmlRpcClientException
Overrides:
setCredentials in class XmlRpcHttpTransport
Throws:
XmlRpcClientException


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