Class CookieUtil


  • class CookieUtil
    extends java.lang.Object
    Helper functions to support the Cookie Manager / Cookie Storage in HttpConnection.
    Since:
    1.14.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String Cookie2Name  
      private static java.lang.String CookieName  
      private static java.util.Map<java.lang.String,​java.util.List<java.lang.String>> EmptyRequestHeaders  
      private static java.lang.String Sep  
    • Constructor Summary

      Constructors 
      Constructor Description
      CookieUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static void applyCookiesToRequest​(HttpConnection.Request req, java.net.HttpURLConnection con)
      Pre-request, get any applicable headers out of the Request cookies and the Cookie Store, and add them to the request headers.
      (package private) static java.net.URI asUri​(java.net.URL url)  
      private static java.util.LinkedHashSet<java.lang.String> requestCookieSet​(Connection.Request req)  
      (package private) static void storeCookies​(HttpConnection.Request req, java.net.URL url, java.util.Map<java.lang.String,​java.util.List<java.lang.String>> resHeaders)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EmptyRequestHeaders

        private static final java.util.Map<java.lang.String,​java.util.List<java.lang.String>> EmptyRequestHeaders
    • Constructor Detail

      • CookieUtil

        CookieUtil()
    • Method Detail

      • applyCookiesToRequest

        static void applyCookiesToRequest​(HttpConnection.Request req,
                                          java.net.HttpURLConnection con)
                                   throws java.io.IOException
        Pre-request, get any applicable headers out of the Request cookies and the Cookie Store, and add them to the request headers. If the Cookie Store duplicates any Request cookies (same name and value), they will be discarded.
        Throws:
        java.io.IOException
      • requestCookieSet

        private static java.util.LinkedHashSet<java.lang.String> requestCookieSet​(Connection.Request req)
      • asUri

        static java.net.URI asUri​(java.net.URL url)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • storeCookies

        static void storeCookies​(HttpConnection.Request req,
                                 java.net.URL url,
                                 java.util.Map<java.lang.String,​java.util.List<java.lang.String>> resHeaders)
                          throws java.io.IOException
        Throws:
        java.io.IOException