Class ClientCookieStore

java.lang.Object
com.sun.enterprise.admin.cli.remote.ClientCookieStore
All Implemented Interfaces:
CookieStore

public class ClientCookieStore extends Object implements CookieStore
This is a derivation of the CookieStore which provides load and store methods which allows the cookies to be stored to and retreived from a file. This CookieStore is specialized for maintaining session cookies for session routing and therefor has side effects that a generalized cookie store would not have. For example when cookies are stored the URI associated with the cookie is not maintained.
  • Constructor Details

    • ClientCookieStore

      public ClientCookieStore(CookieStore cookieStore, File file)
  • Method Details

    • add

      public void add(URI uri, HttpCookie cookie)
      Specified by:
      add in interface CookieStore
    • get

      public List<HttpCookie> get(URI uri)
      Specified by:
      get in interface CookieStore
    • getCookies

      public List<HttpCookie> getCookies()
      Specified by:
      getCookies in interface CookieStore
    • getURIs

      public List<URI> getURIs()
      Specified by:
      getURIs in interface CookieStore
    • remove

      public boolean remove(URI uri, HttpCookie cookie)
      Specified by:
      remove in interface CookieStore
    • removeAll

      public boolean removeAll()
      Specified by:
      removeAll in interface CookieStore
    • getStaticURI

      public URI getStaticURI()
    • load

      public void load() throws IOException
      Load the persisted cookies into the CookieStore. The store has this schema: COOKIE1=xxx; ... COOKIE2=yyy; ...
      Throws:
      IOException
    • store

      public void store() throws IOException
      Store the cookies in the CookieStore to the provided location. This method will overwrite the contents of the target file.
      Throws:
      IOException
    • touchStore

      public boolean touchStore()
      Updates the last modification time of the cache file if it is more than CACHE_WRITE_DELTA old. The file's modification time is use as the creation time for any cookies stored in the cache. We use this time to determine when to expire cookies. As an optimization we don't update the file if a reponse has the *same* set-cookies as what's in the file and the file is less than CACHE_WRITE_DELTA old.