org.apache.xmlrpc
Class CommonsXmlRpcTransport

java.lang.Object
  extended byorg.apache.xmlrpc.CommonsXmlRpcTransport
All Implemented Interfaces:
XmlRpcTransport

public class CommonsXmlRpcTransport
extends java.lang.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,v 1.7 2005/04/28 09:05:06 dlr Exp $
Author:
Ryan Hoegg

Field Summary
private  org.apache.commons.httpclient.HttpClient client
           
private  org.apache.commons.httpclient.Credentials creds
           
private  boolean gzip
           
private  boolean http11
           
protected  org.apache.commons.httpclient.methods.PostMethod method
           
private  boolean rgzip
           
private  java.net.URL url
           
private  org.apache.commons.httpclient.Header userAgentHeader
           
 
Constructor Summary
CommonsXmlRpcTransport(java.net.URL url)
           
CommonsXmlRpcTransport(java.net.URL url, org.apache.commons.httpclient.HttpClient client)
          Creates a new instance of CommonsXmlRpcTransport
 
Method Summary
 void endClientRequest()
          Releases connection resources.
 java.io.InputStream sendXmlRpc(byte[] request)
          Send an XML-RPC message.
 void setBasicAuthentication(java.lang.String user, java.lang.String password)
          Sets Authentication for this client, very basic for now user/password
 void setGzip(boolean gzip)
          Transport make use of the 'Accept-Encoding: gzip', so compliant HTTP servers could return HTTP reply compressed with gzip
 void setHttp11(boolean http11)
          Make use of HTTP 1.1
 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.
 void setUserAgent(java.lang.String userAgent)
          Set the UserAgent for this client
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

method

protected org.apache.commons.httpclient.methods.PostMethod method

url

private java.net.URL url

client

private org.apache.commons.httpclient.HttpClient client

userAgentHeader

private final org.apache.commons.httpclient.Header userAgentHeader

http11

private boolean http11

gzip

private boolean gzip

rgzip

private boolean rgzip

creds

private org.apache.commons.httpclient.Credentials creds
Constructor Detail

CommonsXmlRpcTransport

public CommonsXmlRpcTransport(java.net.URL url,
                              org.apache.commons.httpclient.HttpClient client)
Creates a new instance of CommonsXmlRpcTransport


CommonsXmlRpcTransport

public CommonsXmlRpcTransport(java.net.URL url)
Method Detail

sendXmlRpc

public java.io.InputStream sendXmlRpc(byte[] request)
                               throws java.io.IOException,
                                      XmlRpcClientException
Description copied from interface: XmlRpcTransport
Send an XML-RPC message. This method is called to send a message to the other party.

Specified by:
sendXmlRpc in interface XmlRpcTransport
Parameters:
request - the request in network encoding.
Throws:
XmlRpcClientException - if an exception occurs in the transport.
java.io.IOException - if an IOException occurs in the IO level of the transport.

setHttp11

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

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

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

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

setUserAgent

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

Parameters:
userAgent -

setBasicAuthentication

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

Parameters:
user -
password -

endClientRequest

public void endClientRequest()
                      throws XmlRpcClientException
Releases connection resources.

Specified by:
endClientRequest in interface XmlRpcTransport
Throws:
XmlRpcClientException


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.