protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin) throws MalformedCookieException { List<Cookie> cookies = new ArrayList<Cookie>(elems.length); for (HeaderElement headerelement : elems) { String name = headerelement.getName(); String value = headerelement.getValue(); if (name == null || name.length() == 0) { throw new MalformedCookieException("Cookie name may not be empty"); } BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); // cycle through the parameters NameValuePair[] attribs = headerelement.getParameters(); for (int j = attribs.length - 1; j >= 0; j--) { NameValuePair attrib = attribs[j]; String s = attrib.getName().toLowerCase(Locale.ENGLISH); cookie.setAttribute(s, attrib.getValue()); CookieAttributeHandler handler = findAttribHandler(s); if (handler != null) { handler.parse(cookie, attrib.getValue()); } } cookies.add(cookie); } return cookies; }
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"); } for (CookieAttributeHandler handler: getAttribHandlers()) { handler.validate(cookie, origin); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } String name = cookie.getName(); if (name.indexOf(' ') != -1) { throw new MalformedCookieException("Cookie name may not contain blanks"); } if (name.startsWith("$")) { throw new MalformedCookieException("Cookie name may not start with $"); } super.validate(cookie, origin); }
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin) throws MalformedCookieException { List<Cookie> cookies = new ArrayList<Cookie>(elems.length); for (HeaderElement headerelement : elems) { String name = headerelement.getName(); String value = headerelement.getValue(); if (name == null || name.length() == 0) { throw new MalformedCookieException("Cookie name may not be empty"); } BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); // cycle through the parameters NameValuePair[] attribs = headerelement.getParameters(); for (int j = attribs.length - 1; j >= 0; j--) { NameValuePair attrib = attribs[j]; String s = attrib.getName().toLowerCase(Locale.ENGLISH); cookie.setAttribute(s, attrib.getValue()); CookieAttributeHandler handler = findAttribHandler(s); if (handler != null) { handler.parse(cookie, attrib.getValue()); } } cookies.add(cookie); } return cookies; }
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"); } for (CookieAttributeHandler handler: getAttribHandlers()) { if (!handler.match(cookie, origin)) { return false; } } return true; }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } String name = cookie.getName(); if (name.indexOf(' ') != -1) { throw new MalformedCookieException("Cookie name may not contain blanks"); } if (name.startsWith("$")) { throw new MalformedCookieException("Cookie name may not start with $"); } super.validate(cookie, origin); }
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin) throws MalformedCookieException { final List<Cookie> cookies = new ArrayList<Cookie>(elems.length); for (final HeaderElement headerelement : elems) { final String name = headerelement.getName(); final String value = headerelement.getValue(); if (name == null || name.isEmpty()) { continue; } final BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); // cycle through the parameters final NameValuePair[] attribs = headerelement.getParameters(); for (int j = attribs.length - 1; j >= 0; j--) { final NameValuePair attrib = attribs[j]; final String s = attrib.getName().toLowerCase(Locale.ROOT); cookie.setAttribute(s, attrib.getValue()); final CookieAttributeHandler handler = findAttribHandler(s); if (handler != null) { handler.parse(cookie, attrib.getValue()); } } cookies.add(cookie); } return cookies; }
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"); } for (CookieAttributeHandler handler: getAttribHandlers()) { handler.validate(cookie, origin); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } String name = cookie.getName(); if (name.indexOf(' ') != -1) { throw new MalformedCookieException("Cookie name may not contain blanks"); } if (name.startsWith("$")) { throw new MalformedCookieException("Cookie name may not start with $"); } super.validate(cookie, origin); }
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin) throws MalformedCookieException { final List<Cookie> cookies = new ArrayList<Cookie>(elems.length); for (final HeaderElement headerelement : elems) { final String name = headerelement.getName(); final String value = headerelement.getValue(); if (name == null || name.isEmpty()) { continue; } final BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); // cycle through the parameters final NameValuePair[] attribs = headerelement.getParameters(); for (int j = attribs.length - 1; j >= 0; j--) { final NameValuePair attrib = attribs[j]; final String s = attrib.getName().toLowerCase(Locale.ROOT); cookie.setAttribute(s, attrib.getValue()); final CookieAttributeHandler handler = findAttribHandler(s); if (handler != null) { handler.parse(cookie, attrib.getValue()); } } cookies.add(cookie); } return cookies; }
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"); } for (CookieAttributeHandler handler: getAttribHandlers()) { handler.validate(cookie, origin); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } String name = cookie.getName(); if (name.indexOf(' ') != -1) { throw new MalformedCookieException("Cookie name may not contain blanks"); } if (name.startsWith("$")) { throw new MalformedCookieException("Cookie name may not start with $"); } super.validate(cookie, origin); }
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin) throws MalformedCookieException { final List<Cookie> cookies = new ArrayList<Cookie>(elems.length); for (final HeaderElement headerelement : elems) { final String name = headerelement.getName(); final String value = headerelement.getValue(); if (name == null || name.isEmpty()) { continue; } final BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); // cycle through the parameters final NameValuePair[] attribs = headerelement.getParameters(); for (int j = attribs.length - 1; j >= 0; j--) { final NameValuePair attrib = attribs[j]; final String s = attrib.getName().toLowerCase(Locale.ROOT); cookie.setAttribute(s, attrib.getValue()); final CookieAttributeHandler handler = findAttribHandler(s); if (handler != null) { handler.parse(cookie, attrib.getValue()); } } cookies.add(cookie); } return cookies; }
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"); } for (CookieAttributeHandler handler: getAttribHandlers()) { handler.validate(cookie, origin); } }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } String name = cookie.getName(); if (name.indexOf(' ') != -1) { throw new MalformedCookieException("Cookie name may not contain blanks"); } if (name.startsWith("$")) { throw new MalformedCookieException("Cookie name may not start with $"); } super.validate(cookie, origin); }
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin) throws MalformedCookieException { final List<Cookie> cookies = new ArrayList<Cookie>(elems.length); for (final HeaderElement headerelement : elems) { final String name = headerelement.getName(); final String value = headerelement.getValue(); if (name == null || name.isEmpty()) { continue; } final BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); // cycle through the parameters final NameValuePair[] attribs = headerelement.getParameters(); for (int j = attribs.length - 1; j >= 0; j--) { final NameValuePair attrib = attribs[j]; final String s = attrib.getName().toLowerCase(Locale.ROOT); cookie.setAttribute(s, attrib.getValue()); final CookieAttributeHandler handler = findAttribHandler(s); if (handler != null) { handler.parse(cookie, attrib.getValue()); } } cookies.add(cookie); } return cookies; }
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"); } for (CookieAttributeHandler handler: getAttribHandlers()) { if (!handler.match(cookie, origin)) { return false; } } return true; }
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); final String name = cookie.getName(); if (name.indexOf(' ') != -1) { throw new CookieRestrictionViolationException("Cookie name may not contain blanks"); } if (name.startsWith("$")) { throw new CookieRestrictionViolationException("Cookie name may not start with $"); } super.validate(cookie, origin); }
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin) throws MalformedCookieException { List<Cookie> cookies = new ArrayList<Cookie>(elems.length); for (HeaderElement headerelement : elems) { String name = headerelement.getName(); String value = headerelement.getValue(); if (name == null || name.length() == 0) { throw new MalformedCookieException("Cookie name may not be empty"); } BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); // cycle through the parameters NameValuePair[] attribs = headerelement.getParameters(); for (int j = attribs.length - 1; j >= 0; j--) { NameValuePair attrib = attribs[j]; String s = attrib.getName().toLowerCase(Locale.ENGLISH); cookie.setAttribute(s, attrib.getValue()); CookieAttributeHandler handler = findAttribHandler(s); if (handler != null) { handler.parse(cookie, attrib.getValue()); } } cookies.add(cookie); } return cookies; }
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"); } for (CookieAttributeHandler handler: getAttribHandlers()) { handler.validate(cookie, origin); } }