@Immutable public class BasicHeaderValueFormatterHC4 extends java.lang.Object implements org.apache.http.message.HeaderValueFormatter
| Modifier and Type | Field and Description |
|---|---|
static BasicHeaderValueFormatterHC4 |
DEFAULT
Deprecated.
(4.3) use
INSTANCE |
static BasicHeaderValueFormatterHC4 |
INSTANCE |
static java.lang.String |
SEPARATORS
Special characters that can be used as separators in HTTP parameters.
|
static java.lang.String |
UNSAFE_CHARS
Unsafe special characters that must be escaped using the backslash
character
|
| Constructor and Description |
|---|
BasicHeaderValueFormatterHC4() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doFormatValue(org.apache.http.util.CharArrayBuffer buffer,
java.lang.String value,
boolean quote)
Actually formats the value of a name-value pair.
|
protected int |
estimateElementsLen(org.apache.http.HeaderElement[] elems)
Estimates the length of formatted header elements.
|
protected int |
estimateHeaderElementLen(org.apache.http.HeaderElement elem)
Estimates the length of a formatted header element.
|
protected int |
estimateNameValuePairLen(org.apache.http.NameValuePair nvp)
Estimates the length of a formatted name-value pair.
|
protected int |
estimateParametersLen(org.apache.http.NameValuePair[] nvps)
Estimates the length of formatted parameters.
|
org.apache.http.util.CharArrayBuffer |
formatElements(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.HeaderElement[] elems,
boolean quote) |
static java.lang.String |
formatElements(org.apache.http.HeaderElement[] elems,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
Formats an array of header elements.
|
org.apache.http.util.CharArrayBuffer |
formatHeaderElement(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.HeaderElement elem,
boolean quote) |
static java.lang.String |
formatHeaderElement(org.apache.http.HeaderElement elem,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
Formats a header element.
|
org.apache.http.util.CharArrayBuffer |
formatNameValuePair(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.NameValuePair nvp,
boolean quote) |
static java.lang.String |
formatNameValuePair(org.apache.http.NameValuePair nvp,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
Formats a name-value pair.
|
org.apache.http.util.CharArrayBuffer |
formatParameters(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.NameValuePair[] nvps,
boolean quote) |
static java.lang.String |
formatParameters(org.apache.http.NameValuePair[] nvps,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
Formats a set of parameters.
|
protected boolean |
isSeparator(char ch)
Checks whether a character is a
separator. |
protected boolean |
isUnsafe(char ch)
Checks whether a character is
unsafe. |
@Deprecated public static final BasicHeaderValueFormatterHC4 DEFAULT
INSTANCEBasicHeaderValueFormatter is not a singleton, there
can be many instances of the class itself and of derived classes.
The instance here provides non-customized, default behavior.public static final BasicHeaderValueFormatterHC4 INSTANCE
public static final java.lang.String SEPARATORS
public static final java.lang.String UNSAFE_CHARS
public static java.lang.String formatElements(org.apache.http.HeaderElement[] elems,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
elems - the header elements to formatquote - true to always format with quoted values,
false to use quotes only when necessaryformatter - the formatter to use, or null
for the defaultpublic org.apache.http.util.CharArrayBuffer formatElements(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.HeaderElement[] elems,
boolean quote)
formatElements in interface org.apache.http.message.HeaderValueFormatterprotected int estimateElementsLen(org.apache.http.HeaderElement[] elems)
elems - the header elements to format, or nullpublic static java.lang.String formatHeaderElement(org.apache.http.HeaderElement elem,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
elem - the header element to formatquote - true to always format with quoted values,
false to use quotes only when necessaryformatter - the formatter to use, or null
for the defaultpublic org.apache.http.util.CharArrayBuffer formatHeaderElement(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.HeaderElement elem,
boolean quote)
formatHeaderElement in interface org.apache.http.message.HeaderValueFormatterprotected int estimateHeaderElementLen(org.apache.http.HeaderElement elem)
elem - the header element to format, or nullpublic static java.lang.String formatParameters(org.apache.http.NameValuePair[] nvps,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
nvps - the parameters to formatquote - true to always format with quoted values,
false to use quotes only when necessaryformatter - the formatter to use, or null
for the defaultpublic org.apache.http.util.CharArrayBuffer formatParameters(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.NameValuePair[] nvps,
boolean quote)
formatParameters in interface org.apache.http.message.HeaderValueFormatterprotected int estimateParametersLen(org.apache.http.NameValuePair[] nvps)
nvps - the parameters to format, or nullpublic static java.lang.String formatNameValuePair(org.apache.http.NameValuePair nvp,
boolean quote,
org.apache.http.message.HeaderValueFormatter formatter)
nvp - the name-value pair to formatquote - true to always format with a quoted value,
false to use quotes only when necessaryformatter - the formatter to use, or null
for the defaultpublic org.apache.http.util.CharArrayBuffer formatNameValuePair(org.apache.http.util.CharArrayBuffer charBuffer,
org.apache.http.NameValuePair nvp,
boolean quote)
formatNameValuePair in interface org.apache.http.message.HeaderValueFormatterprotected int estimateNameValuePairLen(org.apache.http.NameValuePair nvp)
nvp - the name-value pair to format, or nullprotected void doFormatValue(org.apache.http.util.CharArrayBuffer buffer,
java.lang.String value,
boolean quote)
formatNameValuePair.buffer - the buffer to append to, never nullvalue - the value to append, never nullquote - true to always format with quotes,
false to use quotes only when necessaryprotected boolean isSeparator(char ch)
separator.ch - the character to checktrue if the character is a separator,
false otherwiseprotected boolean isUnsafe(char ch)
unsafe.ch - the character to checktrue if the character is unsafe,
false otherwiseCopyright © 1999-2015 The Apache Software Foundation. All rights reserved.