Package org.apache.xmlrpc.client
Class XmlRpcLiteHttpTransport
- java.lang.Object
-
- org.apache.xmlrpc.client.XmlRpcTransportImpl
-
- org.apache.xmlrpc.client.XmlRpcStreamTransport
-
- org.apache.xmlrpc.client.XmlRpcHttpTransport
-
- org.apache.xmlrpc.client.XmlRpcLiteHttpTransport
-
- All Implemented Interfaces:
XmlRpcTransport
- Direct Known Subclasses:
XmlRpcLite14HttpTransport
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
Fields Modifier and Type Field Description private XmlRpcHttpClientConfigconfigprivate java.util.Mapheadersprivate java.lang.Stringhostprivate java.lang.Stringhostnameprivate java.io.InputStreaminputprivate java.io.OutputStreamoutputprivate intportprivate booleanresponseGzipCompressedprivate java.net.Socketsocketprivate booleansslprivate java.lang.Stringuriprivate static java.lang.StringuserAgent-
Fields inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
USER_AGENT
-
-
Constructor Summary
Constructors Constructor Description XmlRpcLiteHttpTransport(XmlRpcClient pClient)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclose()Closes the connection and ensures, that all resources are being released.protected java.io.InputStreamgetInputStream()Returns the input stream, from which the response is being read.private java.io.OutputStreamgetOutputStream()protected booleanisResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig)Returns, whether the response is gzip compressed.protected booleanisUsingByteArrayOutput(XmlRpcHttpClientConfig pConfig)protected java.net.SocketnewSocket(boolean pSSL, java.lang.String pHostName, int pPort)private voidsendHeader(java.io.OutputStream pOut, java.lang.String pKey, java.lang.String pValue)java.lang.ObjectsendRequest(XmlRpcRequest pRequest)Send an XML-RPC message.private voidsendRequestHeaders(java.io.OutputStream pOut)protected voidsetRequestHeader(java.lang.String pHeader, java.lang.String pValue)private byte[]toHTTPBytes(java.lang.String pValue)protected voidwriteRequest(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
-
-
-
-
Field Detail
-
userAgent
private static final java.lang.String userAgent
-
ssl
private boolean ssl
-
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(XmlRpcRequest pRequest) throws XmlRpcException
Description copied from interface:XmlRpcTransportSend an XML-RPC message. This method is called to send a message to the other party.- Specified by:
sendRequestin interfaceXmlRpcTransport- Overrides:
sendRequestin classXmlRpcHttpTransport- Parameters:
pRequest- The request being performed.- Returns:
- Result object, if invoking the remote method was successfull.
- Throws:
XmlRpcException- Performing the request failed.
-
setRequestHeader
protected void setRequestHeader(java.lang.String pHeader, java.lang.String pValue)- Specified by:
setRequestHeaderin classXmlRpcHttpTransport
-
close
protected void close() throws XmlRpcClientExceptionDescription copied from class:XmlRpcStreamTransportCloses the connection and ensures, that all resources are being released.- Specified by:
closein classXmlRpcStreamTransport- Throws:
XmlRpcClientException
-
getOutputStream
private java.io.OutputStream getOutputStream() throws XmlRpcException- Throws:
XmlRpcException
-
newSocket
protected java.net.Socket newSocket(boolean pSSL, java.lang.String pHostName, int pPort) throws java.net.UnknownHostException, java.io.IOException- Throws:
java.net.UnknownHostExceptionjava.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(XmlRpcStreamRequestConfig pConfig)
Description copied from class:XmlRpcStreamTransportReturns, whether the response is gzip compressed.- Specified by:
isResponseGzipCompressedin classXmlRpcStreamTransport- Parameters:
pConfig- The clients configuration.- Returns:
- Whether the response stream is gzip compressed.
-
getInputStream
protected java.io.InputStream getInputStream() throws XmlRpcExceptionDescription copied from class:XmlRpcStreamTransportReturns the input stream, from which the response is being read.- Specified by:
getInputStreamin classXmlRpcStreamTransport- Throws:
XmlRpcException
-
isUsingByteArrayOutput
protected boolean isUsingByteArrayOutput(XmlRpcHttpClientConfig pConfig)
- Overrides:
isUsingByteArrayOutputin classXmlRpcHttpTransport
-
writeRequest
protected void writeRequest(XmlRpcStreamTransport.ReqWriter pWriter) throws XmlRpcException, java.io.IOException, org.xml.sax.SAXException
- Specified by:
writeRequestin classXmlRpcStreamTransport- Throws:
XmlRpcExceptionjava.io.IOExceptionorg.xml.sax.SAXException
-
-