Package org.apache.xmlrpc.client
Class XmlRpcCommonsTransport
- java.lang.Object
-
- org.apache.xmlrpc.client.XmlRpcTransportImpl
-
- org.apache.xmlrpc.client.XmlRpcStreamTransport
-
- org.apache.xmlrpc.client.XmlRpcHttpTransport
-
- 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.
-
-
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 protected org.apache.commons.httpclient.HttpClientclientprivate XmlRpcHttpClientConfigconfigprivate intcontentLengthprivate static intMAX_REDIRECT_ATTEMPTSMaximum number of allowed redirects.protected org.apache.commons.httpclient.methods.PostMethodmethodprivate static java.lang.StringuserAgent-
Fields inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
USER_AGENT
-
-
Constructor Summary
Constructors Constructor Description XmlRpcCommonsTransport(XmlRpcCommonsTransportFactory pFactory)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckStatus(org.apache.commons.httpclient.HttpMethod pMethod)Check the status of the HTTP request and throw an XmlRpcHttpTransportException if it indicates that there is an error.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.protected voidinitHttpHeaders(XmlRpcRequest pRequest)protected booleanisRedirectRequired()protected booleanisResponseGzipCompressed()protected booleanisResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig)Returns, whether the response is gzip compressed.protected org.apache.commons.httpclient.HttpClientnewHttpClient()protected org.apache.commons.httpclient.methods.PostMethodnewPostMethod(XmlRpcHttpClientConfig pConfig)protected voidresetClientForRedirect()protected voidsetContentLength(int pLength)protected voidsetCredentials(XmlRpcHttpClientConfig pConfig)protected voidsetRequestHeader(java.lang.String pHeader, java.lang.String pValue)protected voidwriteRequest(XmlRpcStreamTransport.ReqWriter pWriter)-
Methods inherited from class org.apache.xmlrpc.client.XmlRpcHttpTransport
getUserAgent, isUsingByteArrayOutput, newReqWriter, sendRequest, setCompressionHeaders
-
Methods inherited from class org.apache.xmlrpc.client.XmlRpcStreamTransport
isCompressingRequest, newXMLReader, readResponse
-
Methods inherited from class org.apache.xmlrpc.client.XmlRpcTransportImpl
getClient
-
-
-
-
Field Detail
-
MAX_REDIRECT_ATTEMPTS
private static final int MAX_REDIRECT_ATTEMPTS
Maximum number of allowed redirects.- See Also:
- Constant Field Values
-
client
protected final org.apache.commons.httpclient.HttpClient client
-
userAgent
private static final java.lang.String userAgent
-
method
protected org.apache.commons.httpclient.methods.PostMethod method
-
contentLength
private int contentLength
-
config
private XmlRpcHttpClientConfig config
-
-
Constructor Detail
-
XmlRpcCommonsTransport
public XmlRpcCommonsTransport(XmlRpcCommonsTransportFactory pFactory)
Creates a new instance.- Parameters:
pFactory- The factory, which created this transport.
-
-
Method Detail
-
setContentLength
protected void setContentLength(int pLength)
- Overrides:
setContentLengthin classXmlRpcHttpTransport
-
newHttpClient
protected org.apache.commons.httpclient.HttpClient newHttpClient()
-
initHttpHeaders
protected void initHttpHeaders(XmlRpcRequest pRequest) throws XmlRpcClientException
- Overrides:
initHttpHeadersin classXmlRpcHttpTransport- Throws:
XmlRpcClientException
-
newPostMethod
protected org.apache.commons.httpclient.methods.PostMethod newPostMethod(XmlRpcHttpClientConfig pConfig)
-
setRequestHeader
protected void setRequestHeader(java.lang.String pHeader, java.lang.String pValue)- Specified by:
setRequestHeaderin classXmlRpcHttpTransport
-
isResponseGzipCompressed
protected boolean isResponseGzipCompressed()
-
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
-
setCredentials
protected void setCredentials(XmlRpcHttpClientConfig pConfig) throws XmlRpcClientException
- Overrides:
setCredentialsin classXmlRpcHttpTransport- Throws:
XmlRpcClientException
-
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
-
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.
-
isRedirectRequired
protected boolean isRedirectRequired()
-
resetClientForRedirect
protected void resetClientForRedirect() throws XmlRpcException- Throws:
XmlRpcException
-
writeRequest
protected void writeRequest(XmlRpcStreamTransport.ReqWriter pWriter) throws XmlRpcException
- Specified by:
writeRequestin classXmlRpcStreamTransport- Throws:
XmlRpcException
-
checkStatus
private void checkStatus(org.apache.commons.httpclient.HttpMethod pMethod) throws XmlRpcHttpTransportExceptionCheck the status of the HTTP request and throw an XmlRpcHttpTransportException if it indicates that there is an error.- Parameters:
pMethod- the method that has been executed- Throws:
XmlRpcHttpTransportException- if the status of the method indicates that there is an error.
-
-