| java.lang.Object org.apache.commons.httpclient.HttpState
Constructor Summary | |
public | HttpState() Default constructor. |
Method Summary | |
public synchronized void | addCookie(Cookie cookie) Adds an
Cookie HTTP cookie , replacing any existing equivalent cookies. | public synchronized void | addCookies(Cookie[] cookies) Adds an array of
Cookie HTTP cookies . | public void | clear() Clears the state information (all cookies, credentials and proxy credentials). | public synchronized void | clearCookies() Clears all cookies. | public void | clearCredentials() Clears all credentials. | public void | clearProxyCredentials() Clears all proxy credentials. | public int | getCookiePolicy() Returns the current
CookiePolicy cookie policy for this
HTTP state. | public synchronized Cookie[] | getCookies() Returns an array of
Cookie cookies that this HTTP
state currently contains. | public synchronized Cookie[] | getCookies(String domain, int port, String path, boolean secure) Returns an array of
Cookie cookies in this HTTP
state that match the given request parameters. | public synchronized Credentials | getCredentials(String realm, String host) Get the
Credentials credentials for the given authentication scope on the
given host.
If the realm exists on host, return the coresponding credentials.
If the host exists with a null realm, return the corresponding
credentials.
If the realm exists with a null host, return the
corresponding credentials. | public synchronized Credentials | getCredentials(AuthScope authscope) Get the
Credentials credentials for the given authentication scope. | public synchronized Credentials | getProxyCredentials(String realm, String proxyHost) Get the
Credentials credentials for the proxy host with the given
authentication scope.
If the realm exists on host, return the coresponding credentials.
If the host exists with a null realm, return the corresponding
credentials.
If the realm exists with a null host, return the
corresponding credentials. | public synchronized Credentials | getProxyCredentials(AuthScope authscope) Get the
Credentials proxy credentials for the given authentication scope. | public boolean | isAuthenticationPreemptive() Returns true if preemptive authentication should be
attempted, false otherwise. | public synchronized boolean | purgeExpiredCookies() Removes all of
Cookie cookies in this HTTP state
that have expired according to the current system time. | public synchronized boolean | purgeExpiredCookies(Date date) Removes all of
Cookie cookies in this HTTP state
that have expired by the specified
java.util.Date date . | public void | setAuthenticationPreemptive(boolean value) Defines whether preemptive authentication should be
attempted.
Parameters: value - true if preemptive authentication should be attempted, false otherwise. | public void | setCookiePolicy(int policy) Sets the current
CookiePolicy cookie policy for this HTTP
state to one of the following supported policies:
CookiePolicy.COMPATIBILITY ,
CookiePolicy.NETSCAPE_DRAFT or
CookiePolicy.RFC2109 . | public synchronized void | setCredentials(String realm, String host, Credentials credentials) Sets the
Credentials credentials for the given authentication
realm on the given host. | public synchronized void | setCredentials(AuthScope authscope, Credentials credentials) Sets the
Credentials credentials for the given authentication
scope. | public synchronized void | setProxyCredentials(String realm, String proxyHost, Credentials credentials) Sets the
Credentials credentials for the given proxy authentication
realm on the given proxy host. | public synchronized void | setProxyCredentials(AuthScope authscope, Credentials credentials) Sets the
Credentials proxy credentials for the given authentication
realm. | public synchronized String | toString() Returns a string representation of this HTTP state. |
PREEMPTIVE_PROPERTY | final public static String PREEMPTIVE_PROPERTY(Code) | | The boolean system property name to turn on preemptive authentication.
|
HttpState | public HttpState()(Code) | | Default constructor.
|
addCookie | public synchronized void addCookie(Cookie cookie)(Code) | | Adds an
Cookie HTTP cookie , replacing any existing equivalent cookies.
If the given cookie has already expired it will not be added, but existing
values will still be removed.
Parameters: cookie - the Cookie cookie to be added See Also: HttpState.addCookies(Cookie[]) |
addCookies | public synchronized void addCookies(Cookie[] cookies)(Code) | | Adds an array of
Cookie HTTP cookies . Cookies are added individually and
in the given array order. If any of the given cookies has already expired it will
not be added, but existing values will still be removed.
Parameters: cookies - the Cookie cookies to be added See Also: HttpState.addCookie(Cookie) |
clear | public void clear()(Code) | | Clears the state information (all cookies, credentials and proxy credentials).
|
clearCookies | public synchronized void clearCookies()(Code) | | Clears all cookies.
|
clearCredentials | public void clearCredentials()(Code) | | Clears all credentials.
|
clearProxyCredentials | public void clearProxyCredentials()(Code) | | Clears all proxy credentials.
|
getCookies | public synchronized Cookie[] getCookies(String domain, int port, String path, boolean secure)(Code) | | Returns an array of
Cookie cookies in this HTTP
state that match the given request parameters.
Parameters: domain - the request domain Parameters: port - the request port Parameters: path - the request path Parameters: secure - true when using HTTPS an array of Cookie cookies. See Also: HttpState.getCookies() |
getCredentials | public synchronized Credentials getCredentials(String realm, String host)(Code) | | Get the
Credentials credentials for the given authentication scope on the
given host.
If the realm exists on host, return the coresponding credentials.
If the host exists with a null realm, return the corresponding
credentials.
If the realm exists with a null host, return the
corresponding credentials. If the realm does not exist, return
the default Credentials. If there are no default credentials, return
null .
Parameters: realm - the authentication realm Parameters: host - the host the realm is on the credentials See Also: HttpState.setCredentials(String,String,Credentials) |
getProxyCredentials | public synchronized Credentials getProxyCredentials(String realm, String proxyHost)(Code) | | Get the
Credentials credentials for the proxy host with the given
authentication scope.
If the realm exists on host, return the coresponding credentials.
If the host exists with a null realm, return the corresponding
credentials.
If the realm exists with a null host, return the
corresponding credentials. If the realm does not exist, return
the default Credentials. If there are no default credentials, return
null .
Parameters: realm - the authentication realm Parameters: proxyHost - the proxy host the realm is on the credentials See Also: HttpState.setProxyCredentials(String,String,Credentials) |
setCredentials | public synchronized void setCredentials(String realm, String host, Credentials credentials)(Code) | | Sets the
Credentials credentials for the given authentication
realm on the given host. The null realm signifies default
credentials for the given host, which should be used when no
Credentials credentials have been explictly supplied for the
challenging realm. The null host signifies default
credentials, which should be used when no
Credentials credentials
have been explictly supplied for the challenging host. Any previous
credentials for the given realm on the given host will be overwritten.
Parameters: realm - the authentication realm Parameters: host - the host the realm belongs to Parameters: credentials - the authentication Credentials credentials for the given realm. See Also: HttpState.getCredentials(String,String) See Also: HttpState.setProxyCredentials(String,String,Credentials) See Also: |
setProxyCredentials | public synchronized void setProxyCredentials(String realm, String proxyHost, Credentials credentials)(Code) | | Sets the
Credentials credentials for the given proxy authentication
realm on the given proxy host. The null proxy realm signifies
default credentials for the given proxy host, which should be used when no
Credentials credentials have been explictly supplied for the
challenging proxy realm. The null proxy host signifies default
credentials, which should be used when no
Credentials credentials
have been explictly supplied for the challenging proxy host. Any previous
credentials for the given proxy realm on the given proxy host will be
overwritten.
Parameters: realm - the authentication realm Parameters: proxyHost - the proxy host Parameters: credentials - the authentication credentials for the given realm See Also: HttpState.getProxyCredentials(AuthScope) See Also: HttpState.setCredentials(AuthScope,Credentials) |
|
|