@Contract(threading=IMMUTABLE) public class BasicHeaderValueFormatter extends Object implements HeaderValueFormatter
| Modifier and Type | Field and Description |
|---|---|
static BasicHeaderValueFormatter |
DEFAULT
Deprecated.
(4.3) use
INSTANCE |
static BasicHeaderValueFormatter |
INSTANCE |
static String |
SEPARATORS
Special characters that can be used as separators in HTTP parameters.
|
static String |
UNSAFE_CHARS
Unsafe special characters that must be escaped using the backslash
character
|
| Constructor and Description |
|---|
BasicHeaderValueFormatter() |
| Modifier and Type | Method and Description |
|---|---|
CharArrayBuffer |
formatElements(CharArrayBuffer charBuffer,
HeaderElement[] elems,
boolean quote)
Formats an array of header elements.
|
static String |
formatElements(HeaderElement[] elems,
boolean quote,
HeaderValueFormatter formatter)
Formats an array of header elements.
|
CharArrayBuffer |
formatHeaderElement(CharArrayBuffer charBuffer,
HeaderElement elem,
boolean quote)
Formats one header element.
|
static String |
formatHeaderElement(HeaderElement elem,
boolean quote,
HeaderValueFormatter formatter)
Formats a header element.
|
CharArrayBuffer |
formatNameValuePair(CharArrayBuffer charBuffer,
NameValuePair nvp,
boolean quote)
Formats one name-value pair, where the value is optional.
|
static String |
formatNameValuePair(NameValuePair nvp,
boolean quote,
HeaderValueFormatter formatter)
Formats a name-value pair.
|
CharArrayBuffer |
formatParameters(CharArrayBuffer charBuffer,
NameValuePair[] nvps,
boolean quote)
Formats the parameters of a header element.
|
static String |
formatParameters(NameValuePair[] nvps,
boolean quote,
HeaderValueFormatter formatter)
Formats a set of parameters.
|
@Deprecated public static final BasicHeaderValueFormatter 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 BasicHeaderValueFormatter INSTANCE
public static final String SEPARATORS
public static final String UNSAFE_CHARS
public static String formatElements(HeaderElement[] elems, boolean quote, 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 CharArrayBuffer formatElements(CharArrayBuffer charBuffer, HeaderElement[] elems, boolean quote)
HeaderValueFormatterformatElements in interface HeaderValueFormattercharBuffer - the buffer to append to, or
null to create a new bufferelems - the header elements to formatquote - true to always format with quoted values,
false to use quotes only when necessarybuffer argument was not null,
that buffer will be used and returned.public static String formatHeaderElement(HeaderElement elem, boolean quote, 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 CharArrayBuffer formatHeaderElement(CharArrayBuffer charBuffer, HeaderElement elem, boolean quote)
HeaderValueFormatterformatHeaderElement in interface HeaderValueFormattercharBuffer - the buffer to append to, or
null to create a new bufferelem - the header element to formatquote - true to always format with quoted values,
false to use quotes only when necessarybuffer argument was not null,
that buffer will be used and returned.public static String formatParameters(NameValuePair[] nvps, boolean quote, 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 CharArrayBuffer formatParameters(CharArrayBuffer charBuffer, NameValuePair[] nvps, boolean quote)
HeaderValueFormatterformatParameters in interface HeaderValueFormattercharBuffer - the buffer to append to, or
null to create a new buffernvps - the parameters (name-value pairs) to formatquote - true to always format with quoted values,
false to use quotes only when necessarybuffer argument was not null,
that buffer will be used and returned.public static String formatNameValuePair(NameValuePair nvp, boolean quote, 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 CharArrayBuffer formatNameValuePair(CharArrayBuffer charBuffer, NameValuePair nvp, boolean quote)
HeaderValueFormatterformatNameValuePair in interface HeaderValueFormattercharBuffer - the buffer to append to, or
null to create a new buffernvp - the name-value pair to formatquote - true to always format with a quoted value,
false to use quotes only when necessarybuffer argument was not null,
that buffer will be used and returned.Copyright © 2010 - 2020 Adobe. All Rights Reserved