org.apache.http.impl.cookie
Class RFC2965PortAttributeHandler

java.lang.Object
  extended by org.apache.http.impl.cookie.RFC2965PortAttributeHandler
All Implemented Interfaces:
CommonCookieAttributeHandler, CookieAttributeHandler

@Contract(threading=IMMUTABLE)
public class RFC2965PortAttributeHandler
extends Object
implements CommonCookieAttributeHandler

"Port" cookie attribute handler for RFC 2965 cookie spec.

Since:
4.0

Constructor Summary
RFC2965PortAttributeHandler()
           
 
Method Summary
 String getAttributeName()
           
 boolean match(Cookie cookie, CookieOrigin origin)
          Match cookie port attribute.
 void parse(SetCookie cookie, String portValue)
          Parse cookie port attribute.
 void validate(Cookie cookie, CookieOrigin origin)
          Validate cookie port attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RFC2965PortAttributeHandler

public RFC2965PortAttributeHandler()
Method Detail

parse

public void parse(SetCookie cookie,
                  String portValue)
           throws MalformedCookieException
Parse cookie port attribute.

Specified by:
parse in interface CookieAttributeHandler
Parameters:
cookie - Cookie to be updated
portValue - cookie attribute value from the cookie response header
Throws:
MalformedCookieException

validate

public void validate(Cookie cookie,
                     CookieOrigin origin)
              throws MalformedCookieException
Validate cookie port attribute. If the Port attribute was specified in header, the request port must be in cookie's port list.

Specified by:
validate in interface CookieAttributeHandler
Parameters:
cookie - Cookie to validate
origin - the cookie source to validate against
Throws:
MalformedCookieException - if cookie validation fails for this attribute

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

getAttributeName

public String getAttributeName()
Specified by:
getAttributeName in interface CommonCookieAttributeHandler


Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.