public class ApacheHttpClientState extends Object
HttpState
that provides easier
functionality for setting up credentials and proxy credentials.Constructor and Description |
---|
ApacheHttpClientState()
Create a new instance with a default instance of an Apache HTTP state.
|
ApacheHttpClientState(org.apache.commons.httpclient.HttpState state)
Create a new state instance with an Apacahe HTTP state instance.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCredentials()
Clears all credentials.
|
void |
clearProxyCredentials()
Clears all proxy credentials.
|
org.apache.commons.httpclient.HttpState |
getHttpState()
Get the HTTP state.
|
void |
setCredentials(String realm,
String host,
int port,
String usernamepassword)
Sets the credentials for the given authentication scope.
|
void |
setCredentials(String realm,
String host,
int port,
String username,
String password)
Sets the credentials for the given authentication scope.
|
void |
setCredentials(String realm,
String host,
int port,
String username,
String password,
String domain,
String thisHost)
Sets the credentials for the given authentication scope.
|
void |
setProxyCredentials(String realm,
String host,
int port,
String usernamepassword)
Sets the proxy credentials for the given authentication scope.
|
void |
setProxyCredentials(String realm,
String host,
int port,
String username,
String password)
Sets the proxy credentials for the given authentication scope.
|
void |
setProxyCredentials(String realm,
String host,
int port,
String username,
String password,
String domain,
String thisHost)
Sets the proxy credentials for the given authentication scope.
|
public ApacheHttpClientState()
public ApacheHttpClientState(org.apache.commons.httpclient.HttpState state)
state
- the Apache HTTP state.public void setCredentials(String realm, String host, int port, String usernamepassword)
realm
- The authentication realm. The null realm
signifies default credentials for the given host, which should
be used when no credentials have been explicitly supplied for
the challenging realm.host
- The host the realm belongs to. The null host
signifies default credentials which should be used when no
credentials have been explicitly supplied for the challenging
host.port
- The port the realm belongs to. A negitive port
signifies the credentials are applicaple to any port when no
credentials have been explicitly supplied for the challenging
port.usernamepassword
- The username:password formed string.public void setCredentials(String realm, String host, int port, String username, String password)
realm
- The authentication realm. The null realm
signifies default credentials for the given host, which should
be used when no credentials have been explicitly supplied for
the challenging realm.host
- The host the realm belongs to. The null host
signifies default credentials which should be used when no
credentials have been explicitly supplied for the challenging
host.port
- The port the realm belongs to. A negitive port
signifies the credentials are applicaple to any port when no
credentials have been explicitly supplied for the challenging
port.username
- The usernamepassword
- The passwordpublic void setCredentials(String realm, String host, int port, String username, String password, String domain, String thisHost)
realm
- The authentication realm. The null realm
signifies default credentials for the given host, which should
be used when no credentials have been explicitly supplied for
the challenging realm.host
- The host the realm belongs to. The null host
signifies default credentials which should be used when no
credentials have been explicitly supplied for the challenging
host.port
- The port the realm belongs to. A negitive port
signifies the credentials are applicaple to any port when no
credentials have been explicitly supplied for the challenging
port.username
- The username, this should not include the
domain to authenticate with. For example: "user" is correct
wheareas "DOMAIN\\user" is not.password
- The passwordthisHost
- The host the authentication requiest is originating
from. Essentially, the computer name for this machine.domain
- The domain to authentice with.public void setProxyCredentials(String realm, String host, int port, String usernamepassword)
realm
- The authentication realm. The null realm
signifies default credentials for the given host, which should
be used when no credentials have been explicitly supplied for
the challenging realm.host
- The host the realm belongs to. The null host
signifies default credentials which should be used when no
credentials have been explicitly supplied for the challenging
host.port
- The port the realm belongs to. A negitive port
signifies the credentials are applicaple to any port when no
credentials have been explicitly supplied for the challenging
port.usernamepassword
- The username:password formed string.public void setProxyCredentials(String realm, String host, int port, String username, String password)
realm
- The authentication realm. The null realm
signifies default credentials for the given host, which should
be used when no credentials have been explicitly supplied for
the challenging realm.host
- The host the realm belongs to. The null host
signifies default credentials which should be used when no
credentials have been explicitly supplied for the challenging
host.port
- The port the realm belongs to. A negitive port
signifies the credentials are applicaple to any port when no
credentials have been explicitly supplied for the challenging
port.username
- The usernamepassword
- The passwordpublic void setProxyCredentials(String realm, String host, int port, String username, String password, String domain, String thisHost)
realm
- The authentication realm. The null realm
signifies default credentials for the given host, which should
be used when no credentials have been explicitly supplied for
the challenging realm.host
- The host the realm belongs to. The null host
signifies default credentials which should be used when no
credentials have been explicitly supplied for the challenging
host.port
- The port the realm belongs to. A negitive port
signifies the credentials are applicaple to any port when no
credentials have been explicitly supplied for the challenging
port.username
- The username, this should not include the
domain to authenticate with. For example: "user" is correct
wheareas "DOMAIN\\user" is not.password
- The passwordthisHost
- The host the authentication requiest is originating
from. Essentially, the computer name for this machine.domain
- The domain to authentice with.public void clearCredentials()
public void clearProxyCredentials()
public org.apache.commons.httpclient.HttpState getHttpState()
Copyright © 2013 Oracle Corporation. All rights reserved.