Class ServerCookie

  • All Implemented Interfaces:
    java.io.Serializable

    public class ServerCookie
    extends java.lang.Object
    implements java.io.Serializable
    Server-side cookie representation. Stolen from Tomcat.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String ancientDate  
      static java.util.TimeZone GMT_ZONE
      GMT timezone - all HTTP dates are on GMT
      private static java.util.Locale LOCALE_US
      US locale - all HTTP dates are in english
      private static java.lang.String OLD_COOKIE_PATTERN
      Pattern used for old cookies
      private static java.text.DateFormat oldCookieFormat  
      private static java.lang.String tspecials  
      private static java.lang.String tspecials2  
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerCookie()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static boolean alreadyQuoted​(java.lang.String value)  
      static void appendCookieValue​(java.lang.StringBuffer headerBuf, int version, java.lang.String name, java.lang.String value, java.lang.String path, java.lang.String domain, java.lang.String comment, int maxAge, boolean isSecure)  
      static boolean checkName​(java.lang.String name)
      Deprecated.
      Not used: Deprecated in the orginal org.apache.tomcat.util.http.ServerCookie class.
      static boolean containsCTL​(java.lang.String value, int version)  
      private static java.lang.String escapeDoubleQuotes​(java.lang.String s, int beginIndex, int endIndex)
      Escapes any double quotes in the given string.
      static java.lang.String formatOldCookie​(java.util.Date d)  
      static void formatOldCookie​(java.util.Date d, java.lang.StringBuffer sb, java.text.FieldPosition fp)  
      static java.lang.String getCookieHeaderName​(int version)
      Return the header name to set the cookie, based on cookie version.
      static boolean isToken​(java.lang.String value)  
      static boolean isToken2​(java.lang.String value)  
      static void maybeQuote​(int version, java.lang.StringBuffer buf, java.lang.String value)
      Deprecated.
      Not used: Deprecated in the orginal org.apache.tomcat.util.http.ServerCookie class.
      static void maybeQuote2​(int version, java.lang.StringBuffer buf, java.lang.String value)
      Quotes values using rules that vary depending on Cookie version.
      • Methods inherited from class java.lang.Object

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

      • LOCALE_US

        private static final java.util.Locale LOCALE_US
        US locale - all HTTP dates are in english
      • GMT_ZONE

        public static final java.util.TimeZone GMT_ZONE
        GMT timezone - all HTTP dates are on GMT
      • OLD_COOKIE_PATTERN

        private static final java.lang.String OLD_COOKIE_PATTERN
        Pattern used for old cookies
        See Also:
        Constant Field Values
      • oldCookieFormat

        private static final java.text.DateFormat oldCookieFormat
      • ancientDate

        private static final java.lang.String ancientDate
    • Constructor Detail

      • ServerCookie

        public ServerCookie()
    • Method Detail

      • isToken

        public static boolean isToken​(java.lang.String value)
      • containsCTL

        public static boolean containsCTL​(java.lang.String value,
                                          int version)
      • isToken2

        public static boolean isToken2​(java.lang.String value)
      • checkName

        public static boolean checkName​(java.lang.String name)
        Deprecated.
        Not used: Deprecated in the orginal org.apache.tomcat.util.http.ServerCookie class.
      • getCookieHeaderName

        public static java.lang.String getCookieHeaderName​(int version)
        Return the header name to set the cookie, based on cookie version.
      • formatOldCookie

        public static java.lang.String formatOldCookie​(java.util.Date d)
      • formatOldCookie

        public static void formatOldCookie​(java.util.Date d,
                                           java.lang.StringBuffer sb,
                                           java.text.FieldPosition fp)
      • appendCookieValue

        public static void appendCookieValue​(java.lang.StringBuffer headerBuf,
                                             int version,
                                             java.lang.String name,
                                             java.lang.String value,
                                             java.lang.String path,
                                             java.lang.String domain,
                                             java.lang.String comment,
                                             int maxAge,
                                             boolean isSecure)
      • maybeQuote

        @Deprecated
        public static void maybeQuote​(int version,
                                      java.lang.StringBuffer buf,
                                      java.lang.String value)
        Deprecated.
        Not used: Deprecated in the orginal org.apache.tomcat.util.http.ServerCookie class.
      • alreadyQuoted

        public static boolean alreadyQuoted​(java.lang.String value)
      • maybeQuote2

        public static void maybeQuote2​(int version,
                                       java.lang.StringBuffer buf,
                                       java.lang.String value)
        Quotes values using rules that vary depending on Cookie version.
        Parameters:
        version -
        buf -
        value -
      • escapeDoubleQuotes

        private static java.lang.String escapeDoubleQuotes​(java.lang.String s,
                                                           int beginIndex,
                                                           int endIndex)
        Escapes any double quotes in the given string.
        Parameters:
        s - the input string
        beginIndex - start index inclusive
        endIndex - exclusive
        Returns:
        The (possibly) escaped string