/** * @param policy cookie policy to get the CookieSpec for * @return cookie specification interface for the given policy * * @deprecated Use {@link CookiePolicy#getCookieSpec(String)} */ public static CookieSpec getSpecByPolicy(int policy) { switch(policy) { case COMPATIBILITY: return new CookieSpecBase(); case NETSCAPE_DRAFT: return new NetscapeDraftSpec(); case RFC2109: return new RFC2109Spec(); case RFC2965: return new RFC2965Spec(); default: return getDefaultSpec(); } }
/** * Return an array of {@link Cookie}s that should be submitted with a * request with given attributes, <tt>false</tt> otherwise. * @param host the host to which the request is being submitted * @param port the port to which the request is being submitted (currently * ignored) * @param path the path to which the request is being submitted * @param secure <tt>true</tt> if the request is using a secure protocol * @param cookies an array of <tt>Cookie</tt>s to be matched * @return an array of <tt>Cookie</tt>s matching the criterium */ public Cookie[] match(String host, int port, String path, boolean secure, final Cookie cookies[]) { LOG.trace("enter CookieSpecBase.match(" + "String, int, String, boolean, Cookie[])"); if (cookies == null) { return null; } List matching = new LinkedList(); for (int i = 0; i < cookies.length; i++) { if (match(host, port, path, secure, cookies[i])) { addInPathOrder(matching, cookies[i]); } } return (Cookie[]) matching.toArray(new Cookie[matching.size()]); }
|| cookie.getExpiryDate().after(new Date())) && (domainMatch(host, cookie.getDomain())) && (pathMatch(path, cookie.getPath()))
super.parseAttribute(attribute, cookie);
/** * Create a <tt>"Cookie"</tt> {@link Header} containing the {@link Cookie}. * @param cookie <tt>Cookie</tt>s to be formatted as a <tt>Cookie</tt> * header * @return a Cookie header. */ public Header formatCookieHeader(Cookie cookie) { LOG.trace("enter CookieSpecBase.formatCookieHeader(Cookie)"); return new Header("Cookie", formatCookie(cookie)); }
+ "RCF2109CookieProcessor.validate(Cookie)"); super.validate(host, port, path, secure, cookie);
/** * Create a <tt>"Cookie"</tt> {@link Header} containing all {@link Cookie}s * in <i>cookies</i>. * @param cookies an array of {@link Cookie}s to be formatted as a <tt>" * Cookie"</tt> header * @return a <tt>"Cookie"</tt> {@link Header}. */ public Header formatCookieHeader(Cookie[] cookies) { LOG.trace("enter CookieSpecBase.formatCookieHeader(Cookie[])"); return new Header("Cookie", formatCookies(cookies)); }
throw new IllegalArgumentException("Header may not be null."); return parse(host, port, path, secure, header.getValue());
parseAttribute(parameters[j], cookie);
/** * Create a <tt>"Cookie"</tt> header value containing all {@link Cookie}s in * <i>cookies</i> suitable for sending in a <tt>"Cookie"</tt> header * @param cookies an array of {@link Cookie}s to be formatted * @return a string suitable for sending in a Cookie header. * @throws IllegalArgumentException if an input parameter is illegal */ public String formatCookies(Cookie[] cookies) throws IllegalArgumentException { LOG.trace("enter CookieSpecBase.formatCookies(Cookie[])"); if (cookies == null) { throw new IllegalArgumentException("Cookie array may not be null"); } if (cookies.length == 0) { throw new IllegalArgumentException("Cookie array may not be empty"); } StringBuffer buffer = new StringBuffer(); for (int i = 0; i < cookies.length; i++) { if (i > 0) { buffer.append("; "); } buffer.append(formatCookie(cookies[i])); } return buffer.toString(); }
super.validate(host, port, path, secure, cookie);
/** * Create a <tt>"Cookie"</tt> {@link Header} containing all {@link Cookie}s * in <i>cookies</i>. * @param cookies an array of {@link Cookie}s to be formatted as a <tt>" * Cookie"</tt> header * @return a <tt>"Cookie"</tt> {@link Header}. */ public Header formatCookieHeader(Cookie[] cookies) { LOG.trace("enter CookieSpecBase.formatCookieHeader(Cookie[])"); return new Header("Cookie", formatCookies(cookies)); }
throw new IllegalArgumentException("Header may not be null."); return parse(host, port, path, secure, header.getValue());
/** * Return an array of {@link Cookie}s that should be submitted with a * request with given attributes, <tt>false</tt> otherwise. * @param host the host to which the request is being submitted * @param port the port to which the request is being submitted (currently * ignored) * @param path the path to which the request is being submitted * @param secure <tt>true</tt> if the request is using a secure protocol * @param cookies an array of <tt>Cookie</tt>s to be matched * @return an array of <tt>Cookie</tt>s matching the criterium */ public Cookie[] match(String host, int port, String path, boolean secure, final Cookie cookies[]) { LOG.trace("enter CookieSpecBase.match(" + "String, int, String, boolean, Cookie[])"); if (cookies == null) { return null; } List matching = new LinkedList(); for (int i = 0; i < cookies.length; i++) { if (match(host, port, path, secure, cookies[i])) { addInPathOrder(matching, cookies[i]); } } return (Cookie[]) matching.toArray(new Cookie[matching.size()]); }
|| cookie.getExpiryDate().after(new Date())) && (domainMatch(host, cookie.getDomain())) && (pathMatch(path, cookie.getPath()))
super.parseAttribute(attribute, cookie);
/** * Create a <tt>"Cookie"</tt> {@link Header} containing the {@link Cookie}. * @param cookie <tt>Cookie</tt>s to be formatted as a <tt>Cookie</tt> * header * @return a Cookie header. */ public Header formatCookieHeader(Cookie cookie) { LOG.trace("enter CookieSpecBase.formatCookieHeader(Cookie)"); return new Header("Cookie", formatCookie(cookie)); }
+ "RCF2109CookieProcessor.validate(Cookie)"); super.validate(host, port, path, secure, cookie);
/** * Create a <tt>"Cookie"</tt> {@link Header} containing all {@link Cookie}s * in <i>cookies</i>. * @param cookies an array of {@link Cookie}s to be formatted as a <tt>" * Cookie"</tt> header * @return a <tt>"Cookie"</tt> {@link Header}. */ public Header formatCookieHeader(Cookie[] cookies) { LOG.trace("enter CookieSpecBase.formatCookieHeader(Cookie[])"); return new Header("Cookie", formatCookies(cookies)); }
/** * @param policy cookie policy to get the CookieSpec for * @return cookie specification interface for the given policy * * @deprecated Use {@link CookiePolicy#getCookieSpec(String)} */ public static CookieSpec getSpecByPolicy(int policy) { switch(policy) { case COMPATIBILITY: return new CookieSpecBase(); case NETSCAPE_DRAFT: return new NetscapeDraftSpec(); case RFC2109: return new RFC2109Spec(); case RFC2965: return new RFC2965Spec(); default: return getDefaultSpec(); } }