org.apache.xmlrpc

Class CommonsXmlRpcTransport

public class CommonsXmlRpcTransport extends Object implements XmlRpcTransport

Implementor of the XmlRpcTransport interface using the Apache Commons HttpClient library v2.0 available at http://jakarta.apache.org/commons/httpclient/ Note: Currently this transport is not thread safe

Since: 2.0

Version: $Id: CommonsXmlRpcTransport.java 350039 2005-11-30 21:30:55 +0100 (Mi, 30 Nov 2005) jochen $

Author: Ryan Hoegg

Field Summary
HttpClientclient
Credentialscreds
booleangzip
booleanhttp11
protected PostMethodmethod
booleanrgzip
URLurl
HeaderuserAgentHeader
Constructor Summary
CommonsXmlRpcTransport(URL url, HttpClient client)
Creates a new instance of CommonsXmlRpcTransport
CommonsXmlRpcTransport(URL url)
Method Summary
voidendClientRequest()
Releases connection resources.
InputStreamsendXmlRpc(byte[] request)
voidsetBasicAuthentication(String user, String password)
Sets Authentication for this client, very basic for now user/password
voidsetBasicAuthentication(String auth)
Sets Authentication for this client.
voidsetConnectionTimeout(int ctimeout)
Sets the timeout until a connection is etablished.
voidsetGzip(boolean gzip)
Transport make use of the 'Accept-Encoding: gzip', so compliant HTTP servers could return HTTP reply compressed with gzip
voidsetHttp11(boolean http11)
Make use of HTTP 1.1
voidsetRGzip(boolean gzip)
Transport make use of the 'Content-Encoding: gzip' and send HTTP request compressed with gzip : works only with some compliant HTTP servers like Apache 2.x using SetInputFilter DEFLATE.
voidsetTimeout(int timeout)
Sets the socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.
voidsetUserAgent(String userAgent)
Set the UserAgent for this client

Field Detail

client

private HttpClient client

creds

private Credentials creds

gzip

private boolean gzip

http11

private boolean http11

method

protected PostMethod method

rgzip

private boolean rgzip

url

private URL url

userAgentHeader

private final Header userAgentHeader

Constructor Detail

CommonsXmlRpcTransport

public CommonsXmlRpcTransport(URL url, HttpClient client)
Creates a new instance of CommonsXmlRpcTransport

CommonsXmlRpcTransport

public CommonsXmlRpcTransport(URL url)

Method Detail

endClientRequest

public void endClientRequest()
Releases connection resources.

Throws: XmlRpcClientException

sendXmlRpc

public InputStream sendXmlRpc(byte[] request)

setBasicAuthentication

public void setBasicAuthentication(String user, String password)
Sets Authentication for this client, very basic for now user/password

Parameters: user password

setBasicAuthentication

public void setBasicAuthentication(String auth)
Sets Authentication for this client.

Parameters: auth the : formed string used for basic \ authentication

setConnectionTimeout

public void setConnectionTimeout(int ctimeout)
Sets the timeout until a connection is etablished. A timeout value of zero means the timeout is not used. The default value is zero.

Parameters: newTimeoutInMilliseconds Timeout in milliseconds.

See Also: HttpConnection#setConnectionTimeout(int)

setGzip

public void setGzip(boolean gzip)
Transport make use of the 'Accept-Encoding: gzip', so compliant HTTP servers could return HTTP reply compressed with gzip

Parameters: gzip Gzip compression will be used if gzip is true

setHttp11

public void setHttp11(boolean http11)
Make use of HTTP 1.1

Parameters: http11 HTTP 1.1 will be used if http11 is true

setRGzip

public void setRGzip(boolean gzip)
Transport make use of the 'Content-Encoding: gzip' and send HTTP request compressed with gzip : works only with some compliant HTTP servers like Apache 2.x using SetInputFilter DEFLATE.

Parameters: gzip Compress request with gzip if gzip is true

setTimeout

public void setTimeout(int timeout)
Sets the socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout.

Parameters: newTimeoutInMilliseconds Timeout in milliseconds

setUserAgent

public void setUserAgent(String userAgent)
Set the UserAgent for this client

Parameters: userAgent

Copyright B) 1999-2002 Apache Software Foundation. All Rights Reserved.