|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.abdera.protocol.client.AbderaClient
public class AbderaClient
An Atom Publishing Protocol client.
Field Summary | |
---|---|
protected Abdera |
abdera
|
protected Cache |
cache
|
static int |
DEFAULT_MAX_REDIRECTS
|
static String |
DEFAULT_USER_AGENT
|
Constructor Summary | |
---|---|
AbderaClient()
|
|
AbderaClient(Abdera abdera)
Create an AbderaClient instance using the specified Abdera instance |
|
AbderaClient(Abdera abdera,
Cache cache)
Create an AbderaClient instance using the specified Abdera instance |
|
AbderaClient(Abdera abdera,
org.apache.commons.httpclient.HttpClient client)
Create an Abdera using a preconfigured HttpClient object |
|
AbderaClient(Abdera abdera,
org.apache.commons.httpclient.HttpClient client,
Cache cache)
Create an Abdera using a preconfigured HttpClient object |
|
AbderaClient(Abdera abdera,
String useragent)
Create an AbderaClient instance using the specified Abdera instance and useragent name |
|
AbderaClient(Abdera abdera,
String useragent,
Cache cache)
Create an AbderaClient instance using the specified Abdera instance and useragent name |
|
AbderaClient(org.apache.commons.httpclient.HttpClient client)
Create an Abdera using a preconfigured HttpClient object |
|
AbderaClient(String useragent)
Create an AbderaClient instance using the specified useragent name |
Method Summary | |
---|---|
AbderaClient |
addCookie(String domain,
String name,
String value)
Manually add cookies |
AbderaClient |
addCookie(String domain,
String name,
String value,
String path,
Date expires,
boolean secure)
Manually add cookies |
AbderaClient |
addCookie(String domain,
String name,
String value,
String path,
int maxAge,
boolean secure)
Manually add cookies |
AbderaClient |
addCookies(org.apache.commons.httpclient.Cookie... cookies)
Manually add cookies |
AbderaClient |
addCookies(org.apache.commons.httpclient.Cookie cookie)
Manually add cookies |
AbderaClient |
addCredentials(String target,
String realm,
String scheme,
org.apache.commons.httpclient.Credentials credentials)
Add authentication credentials |
AbderaClient |
clearCookies()
Clear the cookies |
AbderaClient |
clearCredentials()
Clear all credentials (including proxy credentials) |
AbderaClient |
clearProxyCredentials()
Clear proxy credentials |
AbderaClient |
clearState()
Clear all state (cookies, credentials, etc) |
ClientResponse |
delete(String uri)
Sends an HTTP DELETE request to the specified URI using the default options |
ClientResponse |
delete(String uri,
RequestOptions options)
Sends an HTTP DELETE request to the specified URI. |
ClientResponse |
execute(String method,
String uri,
Base base,
RequestOptions options)
Sends the specified method request to the specified URI. |
ClientResponse |
execute(String method,
String uri,
EntityProvider provider,
RequestOptions options)
Sends the specified method request to the specified URI. |
ClientResponse |
execute(String method,
String uri,
InputStream in,
RequestOptions options)
Sends the specified method request to the specified URI. |
ClientResponse |
execute(String method,
String uri,
org.apache.commons.httpclient.methods.RequestEntity entity,
RequestOptions options)
Sends the specified method request to the specified URI. |
ClientResponse |
get(String uri)
Sends an HTTP GET request to the specified URI using the default options |
ClientResponse |
get(String uri,
RequestOptions options)
Sends an HTTP GET request to the specified URI. |
String[] |
getAuthenticationSchemePriority()
Returns the current listing of preferred authentication schemes, in order of preference |
Cache |
getCache()
Returns the client HTTP cache instance |
long |
getConnectionManagerTimeout()
Returns the timeout in milliseconds used when retrieving an HTTP connection from the HTTP connection manager. |
int |
getConnectionTimeout()
Return the timeout until a connection is etablished, in milliseconds. |
org.apache.commons.httpclient.Cookie[] |
getCookies()
Get all the cookies |
org.apache.commons.httpclient.Cookie[] |
getCookies(String domain)
Get the cookies for a specific domain |
org.apache.commons.httpclient.Cookie[] |
getCookies(String domain,
String path)
Get the cookies for a specific domain and path |
RequestOptions |
getDefaultRequestOptions()
Get a copy of the default request options |
org.apache.commons.httpclient.params.HttpClientParams |
getHttpClientParams()
Return the HttpClientParams object of the underlying HttpClient. |
org.apache.commons.httpclient.params.HttpConnectionManagerParams |
getHttpConnectionManagerParams()
Return the HttpConnectionManagerParams object of the underlying HttpClient. |
int |
getMaxConnectionsPerHost()
Return the maximum number of connections allowed for a single host |
int |
getMaxConnectionsTotal()
Return the maximum number of connections allowed for the client |
int |
getMaximumRedirects()
Get the maximum number of redirects |
int |
getSocketTimeout()
Return the socket timeout for the connection in milliseconds A timeout value of zero is interpreted as an infinite timeout. |
boolean |
getTcpNoDelay()
Tests if Nagle's algorithm is to be used. |
ClientResponse |
head(String uri)
Sends an HTTP HEAD request to the specified URI using the default options |
ClientResponse |
head(String uri,
RequestOptions options)
Sends an HTTP HEAD request to the specified URI. |
static Cache |
initCache(Abdera abdera)
Initializes the client HTTP cache |
Cache |
initCache(CacheFactory factory)
Deprecated. The CacheFactory interface is no longer used. |
ClientResponse |
post(String uri,
Base base)
Sends an HTTP POST request to the specified URI using the default options |
ClientResponse |
post(String uri,
Base base,
RequestOptions options)
Sends an HTTP POST request to the specified URI. |
ClientResponse |
post(String uri,
EntityProvider provider)
Sends an HTTP POST request to the specified URI using the default options |
ClientResponse |
post(String uri,
EntityProvider provider,
RequestOptions options)
Sends an HTTP POST request to the specified URI. |
ClientResponse |
post(String uri,
Entry entry,
InputStream media)
Sends an HTTP POST request to the specified URI. |
ClientResponse |
post(String uri,
Entry entry,
InputStream media,
RequestOptions options)
Sends an HTTP POST request to the specified URI. |
ClientResponse |
post(String uri,
Entry entry,
InputStream media,
String contentType,
RequestOptions options)
Sends an HTTP POST request to the specified URI. |
ClientResponse |
post(String uri,
InputStream in)
Sends an HTTP POST request to the specified URI using the default options |
ClientResponse |
post(String uri,
InputStream in,
RequestOptions options)
Sends an HTTP POST request to the specified URI. |
ClientResponse |
post(String uri,
org.apache.commons.httpclient.methods.RequestEntity entity)
Sends an HTTP POST request to the specified URI using the default options |
ClientResponse |
post(String uri,
org.apache.commons.httpclient.methods.RequestEntity entity,
RequestOptions options)
Sends an HTTP POST request to the specified URI. |
ClientResponse |
put(String uri,
Base base)
Sends an HTTP PUT request to the specified URI using the default options |
ClientResponse |
put(String uri,
Base base,
RequestOptions options)
Sends an HTTP PUT request to the specified URI. |
ClientResponse |
put(String uri,
EntityProvider provider)
Sends an HTTP PUT request to the specified URI using the default options |
ClientResponse |
put(String uri,
EntityProvider provider,
RequestOptions options)
Sends an HTTP PUT request to the specified URI. |
ClientResponse |
put(String uri,
InputStream in)
Sends an HTTP PUT request to the specified URI using the default options |
ClientResponse |
put(String uri,
InputStream in,
RequestOptions options)
Sends an HTTP PUT request to the specified URI. |
ClientResponse |
put(String uri,
org.apache.commons.httpclient.methods.RequestEntity entity)
Sends an HTTP PUT request to the specified URI using the default options |
ClientResponse |
put(String uri,
org.apache.commons.httpclient.methods.RequestEntity entity,
RequestOptions options)
Sends an HTTP PUT request to the specified URI. |
static void |
registerFactory(org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory factory,
int port)
Register the specified secure socket factory on the specified port |
static void |
registerScheme(String name,
Class<? extends org.apache.commons.httpclient.auth.AuthScheme> scheme)
Register a new authentication scheme. |
static void |
registerTrustManager()
Register the default TrustManager for SSL support on the default port (443) |
static void |
registerTrustManager(int port)
Register the default trust manager on the specified port |
static void |
registerTrustManager(TrustManager trustManager)
Register the specified TrustManager for SSL support on the default port (443) |
static void |
registerTrustManager(TrustManager trustManager,
int port)
Register the specified TrustManager for SSL support on the specified port |
AbderaClient |
setAuthenticationSchemeDefaults()
Configure the client to use the default authentication scheme settings |
AbderaClient |
setAuthenticationSchemePriority(String... scheme)
When multiple authentication schemes are supported by a server, the client will automatically select a scheme based on the configured priority. |
void |
setConnectionManagerTimeout(long timeout)
Sets the timeout in milliseconds used when retrieving an HTTP connection from the HTTP connection manager. |
AbderaClient |
setConnectionTimeout(int timeout)
Sets the timeout until a connection is etablished. |
AbderaClient |
setMaxConnectionsPerHost(int max)
Set the maximum number of connections allowed for a single host |
AbderaClient |
setMaxConnectionsTotal(int max)
Return the maximum number of connections allowed for the client |
AbderaClient |
setMaximumRedirects(int redirects)
Set the maximum number of redirects |
AbderaClient |
setProxy(String host,
int port)
Configure the client to use the specified proxy |
AbderaClient |
setProxyCredentials(String host,
int port,
org.apache.commons.httpclient.Credentials credentials)
Specify the auth credentials for the proxy server |
AbderaClient |
setProxyCredentials(String host,
int port,
String realm,
String scheme,
org.apache.commons.httpclient.Credentials credentials)
Specify the auth credentials for the proxy server |
AbderaClient |
setSocketTimeout(int timeout)
Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. |
void |
setTcpNoDelay(boolean enable)
Determines whether Nagle's algorithm is to be used. |
AbderaClient |
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. |
static void |
unregisterScheme(String... names)
Unregister multiple HTTP authentication schemes |
static void |
unregisterScheme(String name)
Unregister a specific authentication scheme |
AbderaClient |
usePreemptiveAuthentication(boolean val)
Configure the client to use preemptive authentication (HTTP Basic Authentication only) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_USER_AGENT
public static int DEFAULT_MAX_REDIRECTS
protected final Abdera abdera
protected final Cache cache
Constructor Detail |
---|
public AbderaClient()
public AbderaClient(String useragent)
useragent
- public AbderaClient(Abdera abdera, String useragent)
abdera
- useragent
- public AbderaClient(Abdera abdera, String useragent, Cache cache)
abdera
- useragent
- public AbderaClient(org.apache.commons.httpclient.HttpClient client)
client
- An Apache HttpClient objectpublic AbderaClient(Abdera abdera, org.apache.commons.httpclient.HttpClient client)
abdera
- client
- An Apache HttpClient objectpublic AbderaClient(Abdera abdera, org.apache.commons.httpclient.HttpClient client, Cache cache)
abdera
- client
- An Apache HttpClient objectpublic AbderaClient(Abdera abdera)
abdera
- public AbderaClient(Abdera abdera, Cache cache)
abdera
- Method Detail |
---|
public Cache getCache()
public Cache initCache(CacheFactory factory)
public static Cache initCache(Abdera abdera)
public ClientResponse head(String uri, RequestOptions options)
uri
- The request URIoptions
- The request optionspublic ClientResponse get(String uri, RequestOptions options)
uri
- The request URIoptions
- The request optionspublic ClientResponse post(String uri, EntityProvider provider, RequestOptions options)
uri
- The request URIprovider
- An EntityProvider implementation providing the payload of the requestoptions
- The request optionspublic ClientResponse post(String uri, org.apache.commons.httpclient.methods.RequestEntity entity, RequestOptions options)
uri
- The request URIentity
- A RequestEntity object providing the payload of the requestoptions
- The request optionspublic ClientResponse post(String uri, InputStream in, RequestOptions options)
uri
- The request URIin
- An InputStream providing the payload of the requestoptions
- The request optionspublic ClientResponse post(String uri, Base base, RequestOptions options)
uri
- The request URIbase
- An Abdera FOM Document or Element object providing the payload of the requestoptions
- The request optionspublic ClientResponse post(String uri, Entry entry, InputStream media)
uri
- The request URIentry
- The entry that will be sent as the first element of the multipart/related objectmedia
- The media object that will be sent as the second element of the multipart/related objectpublic ClientResponse post(String uri, Entry entry, InputStream media, RequestOptions options)
uri
- The request URIentry
- The entry that will be sent as the first element of the multipart/related objectmedia
- The media object that will be sent as the second element of the multipart/related objectoptions
- The request optionspublic ClientResponse post(String uri, Entry entry, InputStream media, String contentType, RequestOptions options)
uri
- The request URIentry
- The entry that will be sent as the first element of the multipart/related objectmedia
- The media object that will be sent as the second element of the multipart/related objectcontentType
- the content type of the media objectoptions
- The request optionspublic ClientResponse put(String uri, EntityProvider provider, RequestOptions options)
uri
- The request URIprovider
- An EntityProvider implementation providing the payload of the requestoptions
- The request optionspublic ClientResponse put(String uri, org.apache.commons.httpclient.methods.RequestEntity entity, RequestOptions options)
uri
- The request URIentity
- A RequestEntity object providing the payload of the requestoptions
- The request optionspublic ClientResponse put(String uri, InputStream in, RequestOptions options)
uri
- The request URIin
- An InputStream providing the payload of the requestoptions
- The request optionspublic ClientResponse put(String uri, Base base, RequestOptions options)
uri
- The request URIbase
- A FOM Document or Element providing the payload of the requestoptions
- The request optionspublic ClientResponse delete(String uri, RequestOptions options)
uri
- The request URIoptions
- The request optionspublic ClientResponse head(String uri)
uri
- The request URIpublic ClientResponse get(String uri)
uri
- The request URIpublic ClientResponse post(String uri, EntityProvider provider)
uri
- The request URIprovider
- An EntityProvider implementation providing the payload the requestpublic ClientResponse post(String uri, org.apache.commons.httpclient.methods.RequestEntity entity)
uri
- The request URIentity
- A RequestEntity object providing the payload of the requestpublic ClientResponse post(String uri, InputStream in)
uri
- The request URIin
- An InputStream providing the payload of the requestpublic ClientResponse post(String uri, Base base)
uri
- The request URIbase
- A FOM Document or Element providing the payload of the requestpublic ClientResponse put(String uri, EntityProvider provider)
uri
- The request URIprovider
- An EntityProvider implementation providing the payload of the requestpublic ClientResponse put(String uri, org.apache.commons.httpclient.methods.RequestEntity entity)
uri
- The request URIentity
- A RequestEntity object providing the payload of the requestpublic ClientResponse put(String uri, InputStream in)
uri
- The request URIin
- An InputStream providing the payload of the requestpublic ClientResponse put(String uri, Base base)
uri
- The request URIbase
- A FOM Document or Element providing the payload of the requestpublic ClientResponse delete(String uri)
uri
- The request URIpublic static void registerScheme(String name, Class<? extends org.apache.commons.httpclient.auth.AuthScheme> scheme)
name
- scheme
- public static void unregisterScheme(String name)
name
- The name of the authentication scheme (e.g. "basic", "digest", etc)public static void unregisterScheme(String... names)
public static void registerTrustManager(TrustManager trustManager)
trustManager
- The TrustManager implementationpublic static void registerTrustManager()
public static void registerTrustManager(TrustManager trustManager, int port)
trustManager
- The TrustManager implementationport
- The portpublic static void registerTrustManager(int port)
port
- The portpublic static void registerFactory(org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory factory, int port)
public AbderaClient usePreemptiveAuthentication(boolean val)
public ClientResponse execute(String method, String uri, Base base, RequestOptions options)
method
- The HTTP methoduri
- The request URIbase
- A FOM Document and Element providing the payload for the requestoptions
- The Request Optionspublic ClientResponse execute(String method, String uri, EntityProvider provider, RequestOptions options)
method
- The HTTP methoduri
- The request URIprovider
- An EntityProvider implementation providing the payload of the requestoptions
- The Request Optionspublic ClientResponse execute(String method, String uri, InputStream in, RequestOptions options)
method
- The HTTP methoduri
- The request URIin
- An InputStream providing the payload of the requestoptions
- The Request Optionspublic ClientResponse execute(String method, String uri, org.apache.commons.httpclient.methods.RequestEntity entity, RequestOptions options)
method
- The HTTP methoduri
- The request URIentity
- A RequestEntity object providing the payload for the requestoptions
- The Request Optionspublic RequestOptions getDefaultRequestOptions()
public AbderaClient addCredentials(String target, String realm, String scheme, org.apache.commons.httpclient.Credentials credentials) throws URISyntaxException
URISyntaxException
public AbderaClient setAuthenticationSchemeDefaults()
public AbderaClient setAuthenticationSchemePriority(String... scheme)
public String[] getAuthenticationSchemePriority()
setAuthenticationSchemePriority
public AbderaClient 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.
public AbderaClient setMaxConnectionsPerHost(int max)
public int getMaxConnectionsPerHost()
public AbderaClient setMaxConnectionsTotal(int max)
public int getMaxConnectionsTotal()
public AbderaClient setProxy(String host, int port)
public AbderaClient setProxyCredentials(String host, int port, org.apache.commons.httpclient.Credentials credentials)
public AbderaClient setProxyCredentials(String host, int port, String realm, String scheme, org.apache.commons.httpclient.Credentials credentials)
public AbderaClient addCookie(String domain, String name, String value)
public AbderaClient addCookie(String domain, String name, String value, String path, Date expires, boolean secure)
public AbderaClient addCookie(String domain, String name, String value, String path, int maxAge, boolean secure)
public AbderaClient addCookies(org.apache.commons.httpclient.Cookie cookie)
public AbderaClient addCookies(org.apache.commons.httpclient.Cookie... cookies)
public org.apache.commons.httpclient.Cookie[] getCookies()
public org.apache.commons.httpclient.Cookie[] getCookies(String domain, String path)
public org.apache.commons.httpclient.Cookie[] getCookies(String domain)
public AbderaClient clearCookies()
public AbderaClient setConnectionTimeout(int timeout)
public AbderaClient setSocketTimeout(int timeout)
public void setConnectionManagerTimeout(long timeout)
public int getConnectionTimeout()
public int getSocketTimeout()
public long getConnectionManagerTimeout()
public void setTcpNoDelay(boolean enable)
public boolean getTcpNoDelay()
public org.apache.commons.httpclient.params.HttpConnectionManagerParams getHttpConnectionManagerParams()
public org.apache.commons.httpclient.params.HttpClientParams getHttpClientParams()
public AbderaClient setMaximumRedirects(int redirects)
public int getMaximumRedirects()
public AbderaClient clearCredentials()
public AbderaClient clearProxyCredentials()
public AbderaClient clearState()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |