com.versionone.apiclient

## Class CookiesManager

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<String,com.versionone.apiclient.CookieData>
    - - com.versionone.apiclient.CookiesManager

- All Implemented Interfaces:
    ICookiesManager, Serializable, Cloneable, Map<String,com.versionone.apiclient.CookieData>

      public class CookiesManager
      extends HashMap<String,com.versionone.apiclient.CookieData>
      implements ICookiesManager

  Class for process and store cookies for requests to the VersionOne service
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCookie(Map<String,List<String>> headerData)` Store cookie for using in next requests
    `void` | `addCookie(String name, String value, Date expires)` Add cookie to storage
    `protected void` | `addCookiesToRequest(HttpURLConnection request)` Add cookies to requests to the VersionOne service
    `void` | `deleteAllCookies()` Deletes all cookies from the storage
    `void` | `deleteCookie(String name)` Removes cookie from the storage
    `String` | `getCookie(String name)` Gets cookie from the storage.
    `String` | `getCookies()` Creates string with cookies for request.
    `static CookiesManager` | `getCookiesManager(String path)`
    `static CookiesManager` | `getCookiesManager(String path, String userName, String password)`
    `static String` | `getDomenToken(String url)` Generate unique token based on path and user name

    - ### Methods inherited from class java.util.HashMap

      `clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

    - ### Methods inherited from class java.util.AbstractMap

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `equals, hashCode`

- - ### Method Detail

    - #### getCookiesManager

          public static CookiesManager getCookiesManager(String path)

    - #### getCookiesManager

          public static CookiesManager getCookiesManager(String path,
                                                         String userName,
                                                         String password)

    - #### getDomenToken

          public static String getDomenToken(String url)

      Generate unique token based on path and user name
      Parameters:
        `url` - - path to VersionOne
      Returns:
        - unique token

    - #### getCookies

          public String getCookies()

      Creates string with cookies for request. Removes all expired cookies
      Returns:
        cookies for addition to request

    - #### deleteCookie

          public void deleteCookie(String name)

      Removes cookie from the storage
      Specified by:
        `deleteCookie` in interface `ICookiesManager`
      Parameters:
        `name` - - cookie name.

    - #### addCookie

          public void addCookie(Map<String,List<String>> headerData)

      Store cookie for using in next requests
      Parameters:
        `headerData` - Map of response header data

    - #### addCookie

          public void addCookie(String name,
                                String value,
                                Date expires)

      Add cookie to storage
      Specified by:
        `addCookie` in interface `ICookiesManager`
      Parameters:
        `name` - The cookie name
        `value` - The cookie value
        `expires` - The date when the cookie will expire

    - #### addCookiesToRequest

          protected void addCookiesToRequest(HttpURLConnection request)

      Add cookies to requests to the VersionOne service
      Parameters:
        `request` - HttpURLConnection to VersionOne server

    - #### getCookie

          public String getCookie(String name)

      Description copied from interface: `ICookiesManager`
      Gets cookie from the storage.
      Specified by:
        `getCookie` in interface `ICookiesManager`
      Parameters:
        `name` - - cookie name.
      Returns:
        cookie value

    - #### deleteAllCookies

          public void deleteAllCookies()

      Description copied from interface: `ICookiesManager`
      Deletes all cookies from the storage
      Specified by:
        `deleteAllCookies` in interface `ICookiesManager`

Copyright © 2016 VersionOne, Inc.. All rights reserved.