Package org.apache.commons.httpclient
Class HttpState
- java.lang.Object
-
- org.apache.commons.httpclient.HttpState
-
@Deprecated public class HttpState extends java.lang.ObjectDeprecated.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
cookiesand authenticationcredentials.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPREEMPTIVE_DEFAULTDeprecated.This field and feature will be removed following HttpClient 3.0.static java.lang.StringPREEMPTIVE_PROPERTYDeprecated.This field and feature will be removed following HttpClient 3.0.
-
Constructor Summary
Constructors Constructor Description HttpState()Deprecated.Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddCookie(Cookie cookie)Deprecated.Adds anHTTP cookie, replacing any existing equivalent cookies.voidaddCookies(Cookie[] cookies)Deprecated.Adds an array ofHTTP cookies.voidclear()Deprecated.Clears the state information (all cookies, credentials and proxy credentials).voidclearCookies()Deprecated.Clears all cookies.voidclearCredentials()Deprecated.Clears all credentials.voidclearProxyCredentials()Deprecated.Clears all proxy credentials.intgetCookiePolicy()Deprecated.Cookie[]getCookies()Deprecated.Returns an array ofcookiesthat this HTTP state currently contains.Cookie[]getCookies(java.lang.String domain, int port, java.lang.String path, boolean secure)Deprecated.use CookieSpec#match(String, int, String, boolean, Cookie)CredentialsgetCredentials(java.lang.String realm, java.lang.String host)Deprecated.use #getCredentials(AuthScope)CredentialsgetCredentials(AuthScope authscope)Deprecated.Get thecredentialsfor the given authentication scope.CredentialsgetProxyCredentials(java.lang.String realm, java.lang.String proxyHost)Deprecated.use #getProxyCredentials(AuthScope)CredentialsgetProxyCredentials(AuthScope authscope)Deprecated.Get theproxy credentialsfor the given authentication scope.booleanisAuthenticationPreemptive()Deprecated.booleanpurgeExpiredCookies()Deprecated.Removes all ofcookiesin this HTTP state that have expired according to the current system time.booleanpurgeExpiredCookies(java.util.Date date)Deprecated.Removes all ofcookiesin this HTTP state that have expired by the specifieddate.voidsetAuthenticationPreemptive(boolean value)Deprecated.voidsetCookiePolicy(int policy)Deprecated.voidsetCredentials(java.lang.String realm, java.lang.String host, Credentials credentials)Deprecated.use #setCredentials(AuthScope, Credentials)voidsetCredentials(AuthScope authscope, Credentials credentials)Deprecated.Sets thecredentialsfor the given authentication scope.voidsetProxyCredentials(java.lang.String realm, java.lang.String proxyHost, Credentials credentials)Deprecated.use #setProxyCredentials(AuthScope, Credentials)voidsetProxyCredentials(AuthScope authscope, Credentials credentials)Deprecated.Sets theproxy credentialsfor the given authentication realm.java.lang.StringtoString()Deprecated.Returns a string representation of this HTTP state.
-
-
-
Field Detail
-
PREEMPTIVE_PROPERTY
public static final java.lang.String 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:
- Constant Field Values
-
PREEMPTIVE_DEFAULT
public static final java.lang.String PREEMPTIVE_DEFAULT
Deprecated.This field and feature will be removed following HttpClient 3.0.The default value forPREEMPTIVE_PROPERTY.- See Also:
- Constant Field Values
-
-
Method Detail
-
addCookie
public void addCookie(Cookie cookie)
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- thecookieto be added- See Also:
addCookies(Cookie[])
-
addCookies
public void addCookies(Cookie[] cookies)
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- thecookiesto be added- See Also:
addCookie(Cookie)
-
getCookies
public Cookie[] getCookies()
Deprecated.Returns an array ofcookiesthat this HTTP state currently contains.- Returns:
- an array of
cookies. - See Also:
getCookies(String, int, String, boolean)
-
getCookies
public Cookie[] getCookies(java.lang.String domain, int port, java.lang.String path, boolean secure)
Deprecated.use CookieSpec#match(String, int, String, boolean, Cookie)Returns an array ofcookiesin this HTTP state that match the given request parameters.- Parameters:
domain- the request domainport- the request portpath- the request pathsecure-truewhen using HTTPS- Returns:
- an array of
cookies. - See Also:
getCookies()
-
purgeExpiredCookies
public boolean purgeExpiredCookies()
Deprecated.Removes all ofcookiesin this HTTP state that have expired according to the current system time.- See Also:
purgeExpiredCookies(java.util.Date)
-
purgeExpiredCookies
public boolean purgeExpiredCookies(java.util.Date date)
Deprecated.Removes all ofcookiesin this HTTP state that have expired by the specifieddate.- Parameters:
date- Thedateto compare against.- Returns:
- true if any cookies were purged.
- See Also:
Cookie.isExpired(java.util.Date),purgeExpiredCookies()
-
getCookiePolicy
public int getCookiePolicy()
Deprecated.Returns the currentcookie policyfor 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 policyfor this HTTP state to one of the following supported policies:CookiePolicy.COMPATIBILITY,CookiePolicy.NETSCAPE_DRAFTorCookiePolicy.RFC2109.- Parameters:
policy- newcookie policy
-
setCredentials
public void setCredentials(java.lang.String realm, java.lang.String host, Credentials credentials)Deprecated.use #setCredentials(AuthScope, Credentials)Sets thecredentialsfor the given authentication realm on the given host. Thenullrealm signifies default credentials for the given host, which should be used when nocredentialshave been explictly supplied for the challenging realm. Thenullhost signifies default credentials, which should be used when nocredentialshave 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 authenticationcredentialsfor the given realm.- See Also:
getCredentials(String, String),setProxyCredentials(String, String, Credentials)
-
setCredentials
public void setCredentials(AuthScope authscope, Credentials credentials)
Deprecated.Sets thecredentialsfor the given authentication scope. Any previous credentials for the given scope will be overwritten.- Parameters:
authscope- theauthentication scopecredentials- the authenticationcredentialsfor the given scope.- Since:
- 3.0
- See Also:
getCredentials(AuthScope),setProxyCredentials(AuthScope, Credentials)
-
getCredentials
public Credentials getCredentials(java.lang.String realm, java.lang.String host)
Deprecated.use #getCredentials(AuthScope)Get thecredentialsfor 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:
setCredentials(String, String, Credentials)
-
getCredentials
public Credentials getCredentials(AuthScope authscope)
Deprecated.Get thecredentialsfor the given authentication scope.- Parameters:
authscope- theauthentication scope- Returns:
- the credentials
- Since:
- 3.0
- See Also:
setCredentials(AuthScope, Credentials)
-
setProxyCredentials
public void setProxyCredentials(java.lang.String realm, java.lang.String proxyHost, Credentials credentials)Deprecated.use #setProxyCredentials(AuthScope, Credentials)Sets thecredentialsfor the given proxy authentication realm on the given proxy host. Thenullproxy realm signifies default credentials for the given proxy host, which should be used when nocredentialshave been explictly supplied for the challenging proxy realm. Thenullproxy host signifies default credentials, which should be used when nocredentialshave 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:
getProxyCredentials(AuthScope),setCredentials(AuthScope, Credentials)
-
setProxyCredentials
public void setProxyCredentials(AuthScope authscope, Credentials credentials)
Deprecated.Sets theproxy credentialsfor the given authentication realm. Any previous credentials for the given realm will be overwritten.- Parameters:
authscope- theauthentication scopecredentials- the authenticationcredentialsfor the given realm.- Since:
- 3.0
- See Also:
getProxyCredentials(AuthScope),setCredentials(AuthScope, Credentials)
-
getProxyCredentials
public Credentials getProxyCredentials(java.lang.String realm, java.lang.String proxyHost)
Deprecated.use #getProxyCredentials(AuthScope)Get thecredentialsfor 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:
setProxyCredentials(String, String, Credentials)
-
getProxyCredentials
public Credentials getProxyCredentials(AuthScope authscope)
Deprecated.Get theproxy credentialsfor the given authentication scope.- Parameters:
authscope- theauthentication scope- Returns:
- the credentials
- Since:
- 3.0
- See Also:
setProxyCredentials(AuthScope, Credentials)
-
toString
public java.lang.String toString()
Deprecated.Returns a string representation of this HTTP state.- Overrides:
toStringin classjava.lang.Object- Returns:
- The string representation of the HTTP state.
- See Also:
Object.toString()
-
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).
-
-