org.apache.abdera.protocol.client
Class CommonsClient

java.lang.Object
  extended by org.apache.abdera.protocol.client.Client
      extended by org.apache.abdera.protocol.client.CommonsClient

public class CommonsClient
extends Client

The primary Abdera HTTP Client


Field Summary
 
Fields inherited from class org.apache.abdera.protocol.client.Client
abdera, cache
 
Constructor Summary
CommonsClient()
          Initialize the Commons Client using the default Abdera instance and User agent
CommonsClient(Abdera abdera)
          Initialize the Commons Client using the specified Abdera instance and default user agent
CommonsClient(java.lang.String userAgent)
          Initialize the Commons Client using the default Abdera instance and specified user agent
CommonsClient(java.lang.String userAgent, Abdera abdera)
          Initialize the Commons Client using the specified Abdera instance and user agent
 
Method Summary
 void addCredentials(java.lang.String target, java.lang.String realm, java.lang.String scheme, org.apache.commons.httpclient.Credentials credentials)
          Add a set of authentication credentials to the client.
 ClientResponse execute(java.lang.String method, java.lang.String uri, org.apache.commons.httpclient.methods.RequestEntity entity, RequestOptions options)
          Execute an arbitrary HTTP request
 RequestOptions getDefaultRequestOptions()
          Get the default request options used by this client.
 void setAuthenticationSchemePriority(java.lang.String... scheme)
          Set the order in which authentication schemes should be used.
 void teardown()
          Per http://jakarta.apache.org/commons/httpclient/performance.html
 void usePreemptiveAuthentication(boolean val)
          Configure the client to use preemptive authentication (HTTP Basic Authentication only)
 
Methods inherited from class org.apache.abdera.protocol.client.Client
delete, delete, get, get, getCache, head, head, initCache, post, post, post, post, post, post, put, put, put, put, put, put, registerFactory, registerScheme, registerTrustManager, registerTrustManager, registerTrustManager, registerTrustManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonsClient

public CommonsClient()
Initialize the Commons Client using the default Abdera instance and User agent


CommonsClient

public CommonsClient(Abdera abdera)
Initialize the Commons Client using the specified Abdera instance and default user agent


CommonsClient

public CommonsClient(java.lang.String userAgent)
Initialize the Commons Client using the default Abdera instance and specified user agent


CommonsClient

public CommonsClient(java.lang.String userAgent,
                     Abdera abdera)
Initialize the Commons Client using the specified Abdera instance and user agent

Method Detail

usePreemptiveAuthentication

public void usePreemptiveAuthentication(boolean val)
Configure the client to use preemptive authentication (HTTP Basic Authentication only)

Specified by:
usePreemptiveAuthentication in class Client

execute

public ClientResponse execute(java.lang.String method,
                              java.lang.String uri,
                              org.apache.commons.httpclient.methods.RequestEntity entity,
                              RequestOptions options)
Description copied from class: Client
Execute an arbitrary HTTP request

Specified by:
execute in class Client
Parameters:
method - The method name
uri - The URI to execute the request on
entity - The request entity to use for generating the request
options - The options to use for this request
Returns:
the server's response

getDefaultRequestOptions

public RequestOptions getDefaultRequestOptions()
Description copied from class: Client
Get the default request options used by this client.

Specified by:
getDefaultRequestOptions in class Client

addCredentials

public void addCredentials(java.lang.String target,
                           java.lang.String realm,
                           java.lang.String scheme,
                           org.apache.commons.httpclient.Credentials credentials)
                    throws java.net.URISyntaxException
Description copied from class: Client
Add a set of authentication credentials to the client.

Specified by:
addCredentials in class Client
Parameters:
target - The URI for which you wish to authenticate
realm - The authentication realm these credentials apply to, or null if the credentials apply to any realm
scheme - The authentication scheme these credentials apply to, or null if the credentials apply to any scheme
credentials - The credentials to use
Throws:
java.net.URISyntaxException

setAuthenticationSchemePriority

public void setAuthenticationSchemePriority(java.lang.String... scheme)
Description copied from class: Client
Set the order in which authentication schemes should be used.

Specified by:
setAuthenticationSchemePriority in class Client

teardown

public void teardown()

Per http://jakarta.apache.org/commons/httpclient/performance.html

Generally it is recommended to have a single instance of HttpClient per communication component or even per application. However, if the application makes use of HttpClient only very infrequently, and keeping an idle instance of HttpClient in memory is not warranted, it is highly recommended to explicitly shut down the multithreaded connection manager prior to disposing the HttpClient instance. This will ensure proper closure of all HTTP connections in the connection pool.

Overrides:
teardown in class Client