Package org.apache.commons.httpclient
Class HttpState
java.lang.Object
org.apache.commons.httpclient.HttpState
Deprecated.
Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project.
It is not recommended to use it in any new code.
Instead, use HTTP client API plugins as a dependency in your code.
E.g.
Apache HttpComponents Client API 4.x Plugin or
Async HTTP Client Plugin.
A container for HTTP attributes that may persist from request
to request, such as cookies
and authentication
credentials
.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.Adds anHTTP cookie
, replacing any existing equivalent cookies.void
addCookies
(Cookie[] cookies) Deprecated.Adds an array ofHTTP cookies
.void
clear()
Deprecated.Clears the state information (all cookies, credentials and proxy credentials).void
Deprecated.Clears all cookies.void
Deprecated.Clears all credentials.void
Deprecated.Clears all proxy credentials.int
Deprecated.Cookie[]
Deprecated.Returns an array ofcookies
that this HTTP state currently contains.Cookie[]
getCookies
(String domain, int port, String path, boolean secure) Deprecated.use CookieSpec#match(String, int, String, boolean, Cookie)getCredentials
(String realm, String host) Deprecated.use #getCredentials(AuthScope)getCredentials
(AuthScope authscope) Deprecated.Get thecredentials
for the given authentication scope.getProxyCredentials
(String realm, String proxyHost) Deprecated.use #getProxyCredentials(AuthScope)getProxyCredentials
(AuthScope authscope) Deprecated.Get theproxy credentials
for the given authentication scope.boolean
Deprecated.boolean
Deprecated.Removes all ofcookies
in this HTTP state that have expired according to the current system time.boolean
purgeExpiredCookies
(Date date) void
setAuthenticationPreemptive
(boolean value) Deprecated.void
setCookiePolicy
(int policy) Deprecated.void
setCredentials
(String realm, String host, Credentials credentials) Deprecated.use #setCredentials(AuthScope, Credentials)void
setCredentials
(AuthScope authscope, Credentials credentials) Deprecated.Sets thecredentials
for the given authentication scope.void
setProxyCredentials
(String realm, String proxyHost, Credentials credentials) Deprecated.use #setProxyCredentials(AuthScope, Credentials)void
setProxyCredentials
(AuthScope authscope, Credentials credentials) Deprecated.Sets theproxy credentials
for the given authentication realm.toString()
Deprecated.Returns a string representation of this HTTP state.
-
Field Details
-
PREEMPTIVE_PROPERTY
Deprecated.This field and feature will be removed following HttpClient 3.0.The boolean system property name to turn on preemptive authentication.- See Also:
-
PREEMPTIVE_DEFAULT
Deprecated.This field and feature will be removed following HttpClient 3.0.The default value forPREEMPTIVE_PROPERTY
.- See Also:
-
-
Constructor Details
-
HttpState
public HttpState()Deprecated.Default constructor.
-
-
Method Details
-
addCookie
Deprecated.Adds anHTTP 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
- thecookie
to be added- See Also:
-
addCookies
Deprecated.Adds an array ofHTTP 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
- thecookies
to be added- See Also:
-
getCookies
Deprecated.Returns an array ofcookies
that this HTTP state currently contains.- Returns:
- an array of
cookies
. - See Also:
-
getCookies
Deprecated.use CookieSpec#match(String, int, String, boolean, Cookie)Returns an array ofcookies
in this HTTP state that match the given request parameters.- Parameters:
domain
- the request domainport
- the request portpath
- the request pathsecure
-true
when using HTTPS- Returns:
- an array of
cookies
. - See Also:
-
purgeExpiredCookies
public boolean purgeExpiredCookies()Deprecated.Removes all ofcookies
in this HTTP state that have expired according to the current system time.- See Also:
-
purgeExpiredCookies
Deprecated.- Parameters:
date
- Thedate
to compare against.- Returns:
- true if any cookies were purged.
- See Also:
-
getCookiePolicy
public int getCookiePolicy()Deprecated.Returns the currentcookie policy
for this HTTP state.- Returns:
- The
cookie policy
.
-
setAuthenticationPreemptive
public void setAuthenticationPreemptive(boolean value) Deprecated.Defines whether preemptive authentication should be attempted.- Parameters:
value
- true if preemptive authentication should be attempted, false otherwise.
-
isAuthenticationPreemptive
public boolean isAuthenticationPreemptive()Deprecated.Returns true if preemptive authentication should be attempted, false otherwise.- Returns:
- boolean flag.
-
setCookiePolicy
public void setCookiePolicy(int policy) Deprecated.Sets the currentcookie policy
for this HTTP state to one of the following supported policies:CookiePolicy.COMPATIBILITY
,CookiePolicy.NETSCAPE_DRAFT
orCookiePolicy.RFC2109
.- Parameters:
policy
- newcookie policy
-
setCredentials
Deprecated.use #setCredentials(AuthScope, Credentials)Sets thecredentials
for the given authentication realm on the given host. Thenull
realm signifies default credentials for the given host, which should be used when nocredentials
have been explictly supplied for the challenging realm. Thenull
host signifies default credentials, which should be used when nocredentials
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 realmhost
- the host the realm belongs tocredentials
- the authenticationcredentials
for the given realm.- See Also:
-
setCredentials
Deprecated.Sets thecredentials
for the given authentication scope. Any previous credentials for the given scope will be overwritten.- Parameters:
authscope
- theauthentication scope
credentials
- the authenticationcredentials
for the given scope.- Since:
- 3.0
- See Also:
-
getCredentials
Deprecated.use #getCredentials(AuthScope)Get thecredentials
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, returnnull
.- Parameters:
realm
- the authentication realmhost
- the host the realm is on- Returns:
- the credentials
- See Also:
-
getCredentials
Deprecated.Get thecredentials
for the given authentication scope.- Parameters:
authscope
- theauthentication scope
- Returns:
- the credentials
- Since:
- 3.0
- See Also:
-
setProxyCredentials
Deprecated.use #setProxyCredentials(AuthScope, Credentials)Sets thecredentials
for the given proxy authentication realm on the given proxy host. Thenull
proxy realm signifies default credentials for the given proxy host, which should be used when nocredentials
have been explictly supplied for the challenging proxy realm. Thenull
proxy host signifies default credentials, which should be used when nocredentials
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 realmproxyHost
- the proxy hostcredentials
- the authentication credentials for the given realm- See Also:
-
setProxyCredentials
Deprecated.Sets theproxy credentials
for the given authentication realm. Any previous credentials for the given realm will be overwritten.- Parameters:
authscope
- theauthentication scope
credentials
- the authenticationcredentials
for the given realm.- Since:
- 3.0
- See Also:
-
getProxyCredentials
Deprecated.use #getProxyCredentials(AuthScope)Get thecredentials
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, returnnull
.- Parameters:
realm
- the authentication realmproxyHost
- the proxy host the realm is on- Returns:
- the credentials
- See Also:
-
getProxyCredentials
Deprecated.Get theproxy credentials
for the given authentication scope.- Parameters:
authscope
- theauthentication scope
- Returns:
- the credentials
- Since:
- 3.0
- See Also:
-
toString
Deprecated.Returns a string representation of this HTTP state. -
clearCredentials
public void clearCredentials()Deprecated.Clears all credentials. -
clearProxyCredentials
public void clearProxyCredentials()Deprecated.Clears all proxy credentials. -
clearCookies
public void clearCookies()Deprecated.Clears all cookies. -
clear
public void clear()Deprecated.Clears the state information (all cookies, credentials and proxy credentials).
-