Class Cookie


  • public class Cookie
    extends java.lang.Object
    An HTTP client-side cookie.
    Author:
    Russell Gold
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getDomain()
      Returns the domain to which this cookie may be sent.
      long getExpiredTime()  
      java.lang.String getName()
      Returns the name of this cookie.
      java.lang.String getPath()
      Returns the path to which this cookie is restricted.
      java.lang.String getValue()
      Returns the value associated with this cookie.
      int hashCode()  
      boolean isExpired()
      check whether the cookie is expired
      boolean mayBeSentTo​(java.net.URL url)
      may this cookie be sent to the given url?
      void setValue​(java.lang.String value)
      Sets the value associated with this cookie.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getExpiredTime

        public long getExpiredTime()
        Returns:
        the _expiredTime in milliseconds
      • getName

        public java.lang.String getName()
        Returns the name of this cookie.
      • getValue

        public java.lang.String getValue()
        Returns the value associated with this cookie.
      • setValue

        public void setValue​(java.lang.String value)
        Sets the value associated with this cookie.
      • getPath

        public java.lang.String getPath()
        Returns the path to which this cookie is restricted.
      • getDomain

        public java.lang.String getDomain()
        Returns the domain to which this cookie may be sent.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • isExpired

        public boolean isExpired()
        check whether the cookie is expired
        Returns:
        true if the _expiredTime is higher than the current System time
      • mayBeSentTo

        public boolean mayBeSentTo​(java.net.URL url)
        may this cookie be sent to the given url?
        Parameters:
        url - - the unform resource locator to check
        Returns:
        true if the cookie is not expired and the path is accepted if a domain is set