Class RFC2965PortAttributeHandler

    • Constructor Detail

      • RFC2965PortAttributeHandler

        public RFC2965PortAttributeHandler()
    • Method Detail

      • parsePortAttribute

        private static int[] parsePortAttribute​(java.lang.String portValue)
                                         throws MalformedCookieException
        Parses the given Port attribute value (e.g. "8000,8001,8002") into an array of ports.
        Parameters:
        portValue - port attribute value
        Returns:
        parsed array of ports
        Throws:
        MalformedCookieException - if there is a problem in parsing due to invalid portValue.
      • portMatch

        private static boolean portMatch​(int port,
                                         int[] ports)
        Returns true if the given port exists in the given ports list.
        Parameters:
        port - port of host where cookie was received from or being sent to.
        ports - port list
        Returns:
        true returns true if the given port exists in the given ports list; false otherwise.
      • match

        public boolean match​(Cookie cookie,
                             CookieOrigin origin)
        Match cookie port attribute. If the Port attribute is not specified in header, the cookie can be sent to any port. Otherwise, the request port must be in the cookie's port list.
        Specified by:
        match in interface CookieAttributeHandler
        Parameters:
        cookie - Cookie to match
        origin - the cookie source to match against
        Returns:
        true if the match is successful; false otherwise