/** Default constructor */ public RFC2109Spec() { super(); this.formatter = new ParameterFormatter(); this.formatter.setAlwaysUseQuotes(true); }
/** * Produces textual representaion of the attribute/value pair using * formatting rules defined in RFC 2616 * * @param param the parameter to be formatted * * @return RFC 2616 conformant textual representaion of the * attribute/value pair */ public String format(final NameValuePair param) { StringBuffer buffer = new StringBuffer(); format(buffer, param); return buffer.toString(); }
/** * Produces textual representaion of the attribute/value pair using * formatting rules defined in RFC 2616 * * @param buffer output buffer * @param param the parameter to be formatted */ public void format(final StringBuffer buffer, final NameValuePair param) { if (buffer == null) { throw new IllegalArgumentException("String buffer may not be null"); } if (param == null) { throw new IllegalArgumentException("Parameter may not be null"); } buffer.append(param.getName()); String value = param.getValue(); if (value != null) { buffer.append("="); formatValue(buffer, value, this.alwaysUseQuotes); } }
public Header getVersionHeader() { ParameterFormatter formatter = new ParameterFormatter(); StringBuffer buffer = new StringBuffer(); formatter.format(buffer, new NameValuePair("$Version", Integer.toString(getVersion()))); return new Header("Cookie2", buffer.toString(), true); }
for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (isUnsafeChar(ch)) { buffer.append('\\'); for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (isSeparator(ch)) { unsafe = true; if (isUnsafeChar(ch)) { buffer.append('\\');
this.formatter.setAlwaysUseQuotes(!noQuotes); this.formatter.format(buffer, param);
private String doGetMethod(NameValuePair[] data) throws IOException { ParameterFormatter formatter = new ParameterFormatter(); formatter.setAlwaysUseQuotes(false); StringBuilder finalUrl = new StringBuilder(serverUrl); if(data.length > 0) { finalUrl.append("&"); finalUrl.append(formatter.format(data[i]));
private static boolean isUnsafeChar(char ch) { return isOneOf(UNSAFE_CHARS, ch); }
/** * Default constructor for the digest authetication scheme. * * @since 3.0 */ public DigestScheme() { super(); this.complete = false; this.formatter = new ParameterFormatter(); }
public Header getVersionHeader() { ParameterFormatter formatter = new ParameterFormatter(); StringBuffer buffer = new StringBuffer(); formatter.format(buffer, new NameValuePair("$Version", Integer.toString(getVersion()))); return new Header("Cookie2", buffer.toString(), true); }
this.formatter.setAlwaysUseQuotes(!noQuotes); this.formatter.format(buffer, param);
private String doGetMethod(NameValuePair[] data) throws IOException { ParameterFormatter formatter = new ParameterFormatter(); formatter.setAlwaysUseQuotes(false); StringBuilder finalUrl = new StringBuilder(serverUrl); if(data.length > 0) { finalUrl.append("&"); finalUrl.append(formatter.format(data[i]));
for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (isUnsafeChar(ch)) { buffer.append('\\'); for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (isSeparator(ch)) { unsafe = true; if (isUnsafeChar(ch)) { buffer.append('\\');
private static boolean isSeparator(char ch) { return isOneOf(SEPARATORS, ch); }
/** * Default constructor for the digest authetication scheme. * * @since 3.0 */ public DigestScheme() { super(); this.complete = false; this.formatter = new ParameterFormatter(); }
/** * Default constructor * */ public RFC2965Spec() { super(); this.formatter = new ParameterFormatter(); this.formatter.setAlwaysUseQuotes(true); this.attribHandlerMap = new HashMap(10); this.attribHandlerList = new ArrayList(10); this.rfc2109 = new RFC2109Spec(); registerAttribHandler(Cookie2.PATH, new Cookie2PathAttributeHandler()); registerAttribHandler(Cookie2.DOMAIN, new Cookie2DomainAttributeHandler()); registerAttribHandler(Cookie2.PORT, new Cookie2PortAttributeHandler()); registerAttribHandler(Cookie2.MAXAGE, new Cookie2MaxageAttributeHandler()); registerAttribHandler(Cookie2.SECURE, new CookieSecureAttributeHandler()); registerAttribHandler(Cookie2.COMMENT, new CookieCommentAttributeHandler()); registerAttribHandler(Cookie2.COMMENTURL, new CookieCommentUrlAttributeHandler()); registerAttribHandler(Cookie2.DISCARD, new CookieDiscardAttributeHandler()); registerAttribHandler(Cookie2.VERSION, new Cookie2VersionAttributeHandler()); }
/** * Return a name/value string suitable for sending in a <tt>"Cookie"</tt> * header as defined in RFC 2109 for backward compatibility with cookie * version 0 * @param buffer The string buffer to use for output * @param param The parameter. * @param version The cookie version */ private void formatParam(final StringBuffer buffer, final NameValuePair param, int version) { if (version < 1) { buffer.append(param.getName()); buffer.append("="); if (param.getValue() != null) { buffer.append(param.getValue()); } } else { this.formatter.format(buffer, param); } }
public Header getVersionHeader() { ParameterFormatter formatter = new ParameterFormatter(); StringBuffer buffer = new StringBuffer(); formatter.format(buffer, new NameValuePair("$Version", Integer.toString(getVersion()))); return new Header("Cookie2", buffer.toString(), true); }
this.formatter.setAlwaysUseQuotes(!noQuotes); this.formatter.format(buffer, param);
for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (isUnsafeChar(ch)) { buffer.append('\\'); for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (isSeparator(ch)) { unsafe = true; if (isUnsafeChar(ch)) { buffer.append('\\');