Save This Page
Home » commons-httpclient-3.1-src » org.apache.commons » httpclient » [javadoc | source]
org.apache.commons.httpclient
public class: HttpState [javadoc | source]
java.lang.Object
   org.apache.commons.httpclient.HttpState

A container for HTTP attributes that may persist from request to request, such as cookies and authentication credentials .

Field Summary
protected  HashMap credMap    Map of credentials by realm that this HTTP state contains. 
protected  HashMap proxyCred    Map of proxy credentials by realm that this HTTP state contains 
protected  ArrayList cookies    Array of cookies that this HTTP state contains. 
public static final  String PREEMPTIVE_PROPERTY    The boolean system property name to turn on preemptive authentication.
     
    public static final  String PREEMPTIVE_DEFAULT    The default value for #PREEMPTIVE_PROPERTY .
       
      Constructor:
       public HttpState() 
      Method from org.apache.commons.httpclient.HttpState Summary:
      addCookie,   addCookies,   clear,   clearCookies,   clearCredentials,   clearProxyCredentials,   getCookiePolicy,   getCookies,   getCookies,   getCredentials,   getCredentials,   getProxyCredentials,   getProxyCredentials,   isAuthenticationPreemptive,   purgeExpiredCookies,   purgeExpiredCookies,   setAuthenticationPreemptive,   setCookiePolicy,   setCredentials,   setCredentials,   setProxyCredentials,   setProxyCredentials,   toString
      Methods from java.lang.Object:
      equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
      Method from org.apache.commons.httpclient.HttpState Detail:
       public synchronized  void addCookie(Cookie cookie) 
        Adds an 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.
       public synchronized  void addCookies(Cookie[] cookies) 
        Adds an array of 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.
       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() 
      Deprecated! Use - org.apache.commons.httpclient.params.HttpMethodParams#getCookiePolicy() , HttpMethod#getParams() .

       public synchronized Cookie[] getCookies() 
        Returns an array of cookies that this HTTP state currently contains.
       public synchronized Cookie[] getCookies(String domain,
          int port,
          String path,
          boolean secure) 
      Deprecated! use - CookieSpec#match(String, int, String, boolean, Cookie)

        Returns an array of cookies in this HTTP state that match the given request parameters.
       public synchronized Credentials getCredentials(AuthScope authscope) 
        Get the credentials for the given authentication scope.
       public synchronized Credentials getCredentials(String realm,
          String host) 
      Deprecated! use - #getCredentials(AuthScope)

        Get the 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.
       public synchronized Credentials getProxyCredentials(AuthScope authscope) 
       public synchronized Credentials getProxyCredentials(String realm,
          String proxyHost) 
      Deprecated! use - #getProxyCredentials(AuthScope)

        Get the 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.
       public boolean isAuthenticationPreemptive() 
      Deprecated! Use - org.apache.commons.httpclient.params.HttpClientParams#isAuthenticationPreemptive() , HttpClient#getParams() .

        Returns true if preemptive authentication should be attempted, false otherwise.
       public synchronized boolean purgeExpiredCookies() 
        Removes all of cookies in this HTTP state that have expired according to the current system time.
       public synchronized boolean purgeExpiredCookies(Date date) 
        Removes all of cookies in this HTTP state that have expired by the specified date .
       public  void setAuthenticationPreemptive(boolean value) 
      Deprecated! Use - org.apache.commons.httpclient.params.HttpClientParams#setAuthenticationPreemptive(boolean) , HttpClient#getParams() .

        Defines whether preemptive authentication should be attempted.
       public  void setCookiePolicy(int policy) 
      Deprecated! Use - org.apache.commons.httpclient.params.HttpMethodParams#setCookiePolicy(String) , HttpMethod#getParams() .

       public synchronized  void setCredentials(AuthScope authscope,
          Credentials credentials) 
        Sets the credentials for the given authentication scope. Any previous credentials for the given scope will be overwritten.
       public synchronized  void setCredentials(String realm,
          String host,
          Credentials credentials) 
      Deprecated! use - #setCredentials(AuthScope, Credentials)

        Sets the 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 have been explictly supplied for the challenging realm. The null host signifies default credentials, which should be used when no credentials have been explictly supplied for the challenging host. Any previous credentials for the given realm on the given host will be overwritten.
       public synchronized  void setProxyCredentials(AuthScope authscope,
          Credentials credentials) 
        Sets the proxy credentials for the given authentication realm. Any previous credentials for the given realm will be overwritten.
       public synchronized  void setProxyCredentials(String realm,
          String proxyHost,
          Credentials credentials) 
      Deprecated! use - #setProxyCredentials(AuthScope, Credentials)

        Sets the 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 have been explictly supplied for the challenging proxy realm. The null proxy host signifies default credentials, which should be used when no 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.
       public synchronized String toString() 
        Returns a string representation of this HTTP state.