public CookieSpec newInstance(final HttpParams params) { if (params != null) { return new BestMatchSpec( (String []) params.getParameter(CookieSpecPNames.DATE_PATTERNS), params.getBooleanParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, false)); } else { return new BestMatchSpec(); } }
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"); } if (cookie.getVersion() > 0) { return getStrict().match(cookie, origin); } else { return getCompat().match(cookie, origin); } }
return getStrict().parse(helems, origin); } else if (netscape) { return getNetscape().parse(header, origin); } else { return getCompat().parse(helems, origin);
public boolean match(final Cookie cookie, final CookieOrigin origin) { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); if (cookie.getVersion() > 0) { if (cookie instanceof SetCookie2) { return getStrict().match(cookie, origin); } else { return getObsoleteStrict().match(cookie, origin); } } else { return getCompat().match(cookie, origin); } }
public int getVersion() { return getStrict().getVersion(); }
public String rewriteCookie(String headerValue) throws URISyntaxException, InvalidCookieException { BestMatchSpec parser = new BestMatchSpec(); List<Cookie> cookies; try { cookies = parser.parse(new BasicHeader("Set-Cookie", headerValue), new CookieOrigin(targetServer.getHost(), getPortOrDefault(targetServer), targetServer.getPath(), false)); } catch (MalformedCookieException e) { throw new InvalidCookieException(e); } if (cookies.size() != 1) { throw new InvalidCookieException(); } Cookie cookie = rewriteCookiePathIfNeeded(cookies.get(0)); CookieFormatter cookieFormatter = CookieFormatter.createFromApacheCookie(cookie); return cookieFormatter.asString(); }
public void validate( final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); if (cookie.getVersion() > 0) { if (cookie instanceof SetCookie2) { getStrict().validate(cookie, origin); } else { getObsoleteStrict().validate(cookie, origin); } } else { getCompat().validate(cookie, origin); } }
public Header getVersionHeader() { return getStrict().getVersionHeader(); }
public BestMatchSpecFactory(final String[] datepatterns, final boolean oneHeader) { super(); this.cookieSpec = new BestMatchSpec(datepatterns, oneHeader);; }
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"); } if (cookie.getVersion() > 0) { getStrict().validate(cookie, origin); } else { getCompat().validate(cookie, origin); } }
return getStrict().parse(helems, origin); } else if (netscape) { return getNetscape().parse(header, origin); } else { return getCompat().parse(helems, origin);
public List<Header> formatCookies(final List<Cookie> cookies) { Args.notNull(cookies, "List of cookies"); int version = Integer.MAX_VALUE; boolean isSetCookie2 = true; for (final Cookie cookie: cookies) { if (!(cookie instanceof SetCookie2)) { isSetCookie2 = false; } if (cookie.getVersion() < version) { version = cookie.getVersion(); } } if (version > 0) { if (isSetCookie2) { return getStrict().formatCookies(cookies); } else { return getObsoleteStrict().formatCookies(cookies); } } else { return getCompat().formatCookies(cookies); } }
public int getVersion() { return getStrict().getVersion(); }
public BestMatchSpecFactory(final String[] datepatterns, final boolean oneHeader) { super(); this.cookieSpec = new BestMatchSpec(datepatterns, oneHeader);; }
public List<Header> formatCookies(final List<Cookie> cookies) { if (cookies == null) { throw new IllegalArgumentException("List of cookie may not be null"); } int version = Integer.MAX_VALUE; for (Cookie cookie: cookies) { if (cookie.getVersion() < version) { version = cookie.getVersion(); } } if (version > 0) { return getStrict().formatCookies(cookies); } else { return getCompat().formatCookies(cookies); } }
return getStrict().parse(helems, origin); } else if (netscape) { return getNetscape().parse(header, origin); } else { return getCompat().parse(helems, origin);
return getCompat().parse(helems, origin); } else { if (SM.SET_COOKIE2.equals(header.getName())) { return getStrict().parse(helems, origin); } else { return getObsoleteStrict().parse(helems, origin);
public Header getVersionHeader() { return getStrict().getVersionHeader(); }
public BestMatchSpecFactory(final String[] datepatterns, final boolean oneHeader) { super(); this.cookieSpec = new BestMatchSpec(datepatterns, oneHeader);; }
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"); } if (cookie.getVersion() > 0) { return getStrict().match(cookie, origin); } else { return getCompat().match(cookie, origin); } }