Home | History | Annotate | Download | only in cookie

Lines Matching refs:cookie

2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java $
32 package org.apache.http.impl.cookie;
36 import org.apache.http.cookie.ClientCookie;
37 import org.apache.http.cookie.Cookie;
38 import org.apache.http.cookie.CookieAttributeHandler;
39 import org.apache.http.cookie.CookieOrigin;
40 import org.apache.http.cookie.MalformedCookieException;
41 import org.apache.http.cookie.SetCookie;
42 import org.apache.http.cookie.SetCookie2;
45 * <tt>"Port"</tt> cookie attribute handler for RFC 2965 cookie spec.
86 * @param port port of host where cookie was received from or being sent to.
103 * Parse cookie port attribute.
105 public void parse(final SetCookie cookie, final String portValue)
107 if (cookie == null) {
108 throw new IllegalArgumentException("Cookie may not be null");
110 if (cookie instanceof SetCookie2) {
111 SetCookie2 cookie2 = (SetCookie2) cookie;
120 * Validate cookie port attribute. If the Port attribute was specified
121 * in header, the request port must be in cookie's port list.
123 public void validate(final Cookie cookie, final CookieOrigin origin)
125 if (cookie == null) {
126 throw new IllegalArgumentException("Cookie may not be null");
129 throw new IllegalArgumentException("Cookie origin may not be null");
132 if (cookie instanceof ClientCookie
133 && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) {
134 if (!portMatch(port, cookie.getPorts())) {
137 + "Request port not found in cookie's port list.");
143 * Match cookie port attribute. If the Port attribute is not specified
144 * in header, the cookie can be sent to any port. Otherwise, the request port
145 * must be in the cookie's port list.
147 public boolean match(final Cookie cookie, final CookieOrigin origin) {
148 if (cookie == null) {
149 throw new IllegalArgumentException("Cookie may not be null");
152 throw new IllegalArgumentException("Cookie origin may not be null");
155 if (cookie instanceof ClientCookie
156 && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) {
157 if (cookie.getPorts() == null) {
158 // Invalid cookie state: port not specified
161 if (!portMatch(port, cookie.getPorts())) {