org.apache.xmlrpc.client
Class XmlRpcLiteHttpTransport

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.XmlRpcLiteHttpTransport
All Implemented Interfaces:
XmlRpcTransport

public class XmlRpcLiteHttpTransport
extends XmlRpcHttpTransport

A "light" HTTP transport implementation.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
XmlRpcHttpTransport.ByteArrayReqWriter
 
Nested classes/interfaces inherited from class org.apache.xmlrpc.client.XmlRpcStreamTransport
XmlRpcStreamTransport.GzipReqWriter, XmlRpcStreamTransport.ReqWriter, XmlRpcStreamTransport.ReqWriterImpl
 
Field Summary
private  XmlRpcHttpClientConfig config
           
private  java.util.Map headers
           
private  java.lang.String host
           
private  java.lang.String hostname
           
private  java.io.InputStream input
           
private  java.io.OutputStream output
           
private  int port
           
private  boolean responseGzipCompressed
           
private  java.net.Socket socket
           
private  java.lang.String uri
           
private static java.lang.String userAgent
           
 
Fields inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
USER_AGENT
 
Constructor Summary
XmlRpcLiteHttpTransport(XmlRpcClient pClient)
          Creates a new instance.
 
Method Summary
protected  void close()
          Closes the connection and ensures, that all resources are being released.
protected  java.io.InputStream getInputStream()
          Returns the input stream, from which the response is being read.
private  java.io.OutputStream getOutputStream()
           
protected  boolean isResponseGzipCompressed(org.apache.xmlrpc.common.XmlRpcStreamRequestConfig pConfig)
          Returns, whether the response is gzip compressed.
protected  boolean isUsingByteArrayOutput(XmlRpcHttpClientConfig pConfig)
           
protected  java.net.Socket newSocket(java.lang.String pHostName, int pPort)
           
private  void sendHeader(java.io.OutputStream pOut, java.lang.String pKey, java.lang.String pValue)
           
 java.lang.Object sendRequest(org.apache.xmlrpc.XmlRpcRequest pRequest)
          Send an XML-RPC message.
private  void sendRequestHeaders(java.io.OutputStream pOut)
           
protected  void setRequestHeader(java.lang.String pHeader, java.lang.String pValue)
           
private  byte[] toHTTPBytes(java.lang.String pValue)
           
protected  void writeRequest(XmlRpcStreamTransport.ReqWriter pWriter)
           
 
Methods inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
getUserAgent, initHttpHeaders, newReqWriter, setCompressionHeaders, setContentLength, setCredentials
 
Methods inherited from class org.apache.xmlrpc.client.XmlRpcStreamTransport
isCompressingRequest, newXMLReader, readResponse
 
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
 

Field Detail

userAgent

private static final java.lang.String userAgent
See Also:
Constant Field Values

hostname

private java.lang.String hostname

host

private java.lang.String host

port

private int port

uri

private java.lang.String uri

socket

private java.net.Socket socket

output

private java.io.OutputStream output

input

private java.io.InputStream input

headers

private final java.util.Map headers

responseGzipCompressed

private boolean responseGzipCompressed

config

private XmlRpcHttpClientConfig config
Constructor Detail

XmlRpcLiteHttpTransport

public XmlRpcLiteHttpTransport(XmlRpcClient pClient)
Creates a new instance.

Parameters:
pClient - The client controlling this instance.
Method Detail

sendRequest

public java.lang.Object sendRequest(org.apache.xmlrpc.XmlRpcRequest pRequest)
                             throws org.apache.xmlrpc.XmlRpcException
Description copied from interface: XmlRpcTransport
Send an XML-RPC message. This method is called to send a message to the other party.

Specified by:
sendRequest in interface XmlRpcTransport
Overrides:
sendRequest in class XmlRpcHttpTransport
Parameters:
pRequest - The request being performed.
Returns:
Result object, if invoking the remote method was successfull.
Throws:
org.apache.xmlrpc.XmlRpcException - Performing the request failed.

setRequestHeader

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

close

protected void close()
              throws XmlRpcClientException
Description copied from class: XmlRpcStreamTransport
Closes the connection and ensures, that all resources are being released.

Specified by:
close in class XmlRpcStreamTransport
Throws:
XmlRpcClientException

getOutputStream

private java.io.OutputStream getOutputStream()
                                      throws org.apache.xmlrpc.XmlRpcException
Throws:
org.apache.xmlrpc.XmlRpcException

newSocket

protected java.net.Socket newSocket(java.lang.String pHostName,
                                    int pPort)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Throws:
java.net.UnknownHostException
java.io.IOException

toHTTPBytes

private byte[] toHTTPBytes(java.lang.String pValue)
                    throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

sendHeader

private void sendHeader(java.io.OutputStream pOut,
                        java.lang.String pKey,
                        java.lang.String pValue)
                 throws java.io.IOException
Throws:
java.io.IOException

sendRequestHeaders

private void sendRequestHeaders(java.io.OutputStream pOut)
                         throws java.io.IOException
Throws:
java.io.IOException

isResponseGzipCompressed

protected boolean isResponseGzipCompressed(org.apache.xmlrpc.common.XmlRpcStreamRequestConfig pConfig)
Description copied from class: XmlRpcStreamTransport
Returns, whether the response is gzip compressed.

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

getInputStream

protected java.io.InputStream getInputStream()
                                      throws org.apache.xmlrpc.XmlRpcException
Description copied from class: XmlRpcStreamTransport
Returns the input stream, from which the response is being read.

Specified by:
getInputStream in class XmlRpcStreamTransport
Throws:
org.apache.xmlrpc.XmlRpcException

isUsingByteArrayOutput

protected boolean isUsingByteArrayOutput(XmlRpcHttpClientConfig pConfig)
Overrides:
isUsingByteArrayOutput in class XmlRpcHttpTransport

writeRequest

protected void writeRequest(XmlRpcStreamTransport.ReqWriter pWriter)
                     throws org.apache.xmlrpc.XmlRpcException,
                            java.io.IOException,
                            org.xml.sax.SAXException
Specified by:
writeRequest in class XmlRpcStreamTransport
Throws:
org.apache.xmlrpc.XmlRpcException
java.io.IOException
org.xml.sax.SAXException