|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.http.message.BasicHeaderValueFormatterHC4
@Immutable public class BasicHeaderValueFormatterHC4
Basic implementation for formatting header value elements. Instances of this class are stateless and thread-safe. Derived classes are expected to maintain these properties.
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
BasicHeaderValueFormatterHC4()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@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
| Constructor Detail |
|---|
public BasicHeaderValueFormatterHC4()
| Method Detail |
|---|
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 default
public 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 null
public 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 default
public 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 null
public 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 default
public 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 null
public 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 default
public 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 null
protected 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 check
true if the character is a separator,
false otherwiseprotected boolean isUnsafe(char ch)
unsafe.
ch - the character to check
true if the character is unsafe,
false otherwise
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||