public RFC2965Spec(final String[] datepatterns, boolean oneHeader) { super(datepatterns, oneHeader); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new RFC2965DomainAttributeHandler()); registerAttribHandler(ClientCookie.PORT_ATTR, new RFC2965PortAttributeHandler()); registerAttribHandler(ClientCookie.COMMENTURL_ATTR, new RFC2965CommentUrlAttributeHandler()); registerAttribHandler(ClientCookie.DISCARD_ATTR, new RFC2965DiscardAttributeHandler()); registerAttribHandler(ClientCookie.VERSION_ATTR, new RFC2965VersionAttributeHandler()); }
/** * Parse cookie port attribute. */ public void parse(final SetCookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof SetCookie2) { SetCookie2 cookie2 = (SetCookie2) cookie; if (portValue != null && portValue.trim().length() > 0) { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } } }
/** * Validate cookie port attribute. If the Port attribute was specified * in header, the request port must be in cookie's port list. */ public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } int port = origin.getPort(); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) { if (!portMatch(port, cookie.getPorts())) { throw new MalformedCookieException( "Port attribute violates RFC 2965: " + "Request port not found in cookie's port list."); } } }
new RFC2965PortAttributeHandler(), new BasicMaxAgeHandler(), new BasicSecureHandler(),
/** * 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. */ public boolean match(final Cookie cookie, final CookieOrigin origin) { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } int port = origin.getPort(); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) { if (cookie.getPorts() == null) { // Invalid cookie state: port not specified return false; } if (!portMatch(port, cookie.getPorts())) { return false; } } return true; }
/** * Parse cookie port attribute. */ public void parse(final SetCookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof SetCookie2) { SetCookie2 cookie2 = (SetCookie2) cookie; if (portValue != null && portValue.trim().length() > 0) { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } } }
public RFC2965Spec(final String[] datepatterns, boolean oneHeader) { super(datepatterns, oneHeader); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new RFC2965DomainAttributeHandler()); registerAttribHandler(ClientCookie.PORT_ATTR, new RFC2965PortAttributeHandler()); registerAttribHandler(ClientCookie.COMMENTURL_ATTR, new RFC2965CommentUrlAttributeHandler()); registerAttribHandler(ClientCookie.DISCARD_ATTR, new RFC2965DiscardAttributeHandler()); registerAttribHandler(ClientCookie.VERSION_ATTR, new RFC2965VersionAttributeHandler()); }
/** * Validate cookie port attribute. If the Port attribute was specified * in header, the request port must be in cookie's port list. */ public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } int port = origin.getPort(); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) { if (!portMatch(port, cookie.getPorts())) { throw new MalformedCookieException( "Port attribute violates RFC 2965: " + "Request port not found in cookie's port list."); } } }
/** * Parse cookie port attribute. */ public void parse(final SetCookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof SetCookie2) { SetCookie2 cookie2 = (SetCookie2) cookie; if (portValue != null && portValue.trim().length() > 0) { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } } }
public RFC2965Spec(final String[] datepatterns, final boolean oneHeader) { super(datepatterns, oneHeader); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new RFC2965DomainAttributeHandler()); registerAttribHandler(ClientCookie.PORT_ATTR, new RFC2965PortAttributeHandler()); registerAttribHandler(ClientCookie.COMMENTURL_ATTR, new RFC2965CommentUrlAttributeHandler()); registerAttribHandler(ClientCookie.DISCARD_ATTR, new RFC2965DiscardAttributeHandler()); registerAttribHandler(ClientCookie.VERSION_ATTR, new RFC2965VersionAttributeHandler()); }
/** * Validate cookie port attribute. If the Port attribute was specified * in header, the request port must be in cookie's port list. */ public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } int port = origin.getPort(); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) { if (!portMatch(port, cookie.getPorts())) { throw new MalformedCookieException( "Port attribute violates RFC 2965: " + "Request port not found in cookie's port list."); } } }
/** * Parse cookie port attribute. */ public void parse(final SetCookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof SetCookie2) { SetCookie2 cookie2 = (SetCookie2) cookie; if (portValue != null && portValue.trim().length() > 0) { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } } }
public RFC2965Spec(final String[] datepatterns, boolean oneHeader) { super(datepatterns, oneHeader); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new RFC2965DomainAttributeHandler()); registerAttribHandler(ClientCookie.PORT_ATTR, new RFC2965PortAttributeHandler()); registerAttribHandler(ClientCookie.COMMENTURL_ATTR, new RFC2965CommentUrlAttributeHandler()); registerAttribHandler(ClientCookie.DISCARD_ATTR, new RFC2965DiscardAttributeHandler()); registerAttribHandler(ClientCookie.VERSION_ATTR, new RFC2965VersionAttributeHandler()); }
/** * Validate cookie port attribute. If the Port attribute was specified * in header, the request port must be in cookie's port list. */ public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } int port = origin.getPort(); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) { if (!portMatch(port, cookie.getPorts())) { throw new MalformedCookieException( "Port attribute violates RFC 2965: " + "Request port not found in cookie's port list."); } } }
/** * Parse cookie port attribute. */ public void parse(final SetCookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof SetCookie2) { SetCookie2 cookie2 = (SetCookie2) cookie; if (portValue != null && portValue.trim().length() > 0) { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } } }
public RFC2965Spec(final String[] datepatterns, boolean oneHeader) { super(datepatterns, oneHeader); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new RFC2965DomainAttributeHandler()); registerAttribHandler(ClientCookie.PORT_ATTR, new RFC2965PortAttributeHandler()); registerAttribHandler(ClientCookie.COMMENTURL_ATTR, new RFC2965CommentUrlAttributeHandler()); registerAttribHandler(ClientCookie.DISCARD_ATTR, new RFC2965DiscardAttributeHandler()); registerAttribHandler(ClientCookie.VERSION_ATTR, new RFC2965VersionAttributeHandler()); }
/** * 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. */ public boolean match(final Cookie cookie, final CookieOrigin origin) { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } int port = origin.getPort(); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) { if (cookie.getPorts() == null) { // Invalid cookie state: port not specified return false; } if (!portMatch(port, cookie.getPorts())) { return false; } } return true; }
/** * Parse cookie port attribute. */ public void parse(final SetCookie cookie, final String portValue) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); if (cookie instanceof SetCookie2) { final SetCookie2 cookie2 = (SetCookie2) cookie; if (portValue != null && portValue.trim().length() > 0) { final int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } } }
public RFC2965Spec(final String[] datepatterns, boolean oneHeader) { super(datepatterns, oneHeader); registerAttribHandler(ClientCookie.DOMAIN_ATTR, new RFC2965DomainAttributeHandler()); registerAttribHandler(ClientCookie.PORT_ATTR, new RFC2965PortAttributeHandler()); registerAttribHandler(ClientCookie.COMMENTURL_ATTR, new RFC2965CommentUrlAttributeHandler()); registerAttribHandler(ClientCookie.DISCARD_ATTR, new RFC2965DiscardAttributeHandler()); registerAttribHandler(ClientCookie.VERSION_ATTR, new RFC2965VersionAttributeHandler()); }
/** * 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. */ public boolean match(final Cookie cookie, final CookieOrigin origin) { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (origin == null) { throw new IllegalArgumentException("Cookie origin may not be null"); } int port = origin.getPort(); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) { if (cookie.getPorts() == null) { // Invalid cookie state: port not specified return false; } if (!portMatch(port, cookie.getPorts())) { return false; } } return true; }