| java.lang.Object org.apache.http.message.BasicHeaderValueFormatter
BasicHeaderValueFormatter | public class BasicHeaderValueFormatter implements HeaderValueFormatter(Code) | | Basic implementation for formatting header value elements.
Instances of this class are stateless and thread-safe.
Derived classes are expected to maintain these properties.
author: Oleg Kalnichevski author: and others author: version: $Revision: 574185 $ since: 4.0 |
Method Summary | |
protected void | doFormatValue(CharArrayBuffer buffer, String value, boolean quote) Actually formats the value of a name-value pair. | protected int | estimateElementsLen(HeaderElement[] elems) Estimates the length of formatted header elements. | protected int | estimateHeaderElementLen(HeaderElement elem) Estimates the length of a formatted header element. | protected int | estimateNameValuePairLen(NameValuePair nvp) Estimates the length of a formatted name-value pair. | protected int | estimateParametersLen(NameValuePair[] nvps) Estimates the length of formatted parameters. | final public static String | formatElements(HeaderElement[] elems, boolean quote, HeaderValueFormatter formatter) Formats an array of header elements. | public CharArrayBuffer | formatElements(CharArrayBuffer buffer, HeaderElement[] elems, boolean quote) | final public static String | formatHeaderElement(HeaderElement elem, boolean quote, HeaderValueFormatter formatter) Formats a header element. | public CharArrayBuffer | formatHeaderElement(CharArrayBuffer buffer, HeaderElement elem, boolean quote) | final public static String | formatNameValuePair(NameValuePair nvp, boolean quote, HeaderValueFormatter formatter) Formats a name-value pair. | public CharArrayBuffer | formatNameValuePair(CharArrayBuffer buffer, NameValuePair nvp, boolean quote) | final public static String | formatParameters(NameValuePair[] nvps, boolean quote, HeaderValueFormatter formatter) Formats a set of parameters. | public CharArrayBuffer | formatParameters(CharArrayBuffer buffer, NameValuePair[] nvps, boolean quote) | protected boolean | isSeparator(char ch) Checks whether a character is a
BasicHeaderValueFormatter.SEPARATORS separator . | protected boolean | isUnsafe(char ch) Checks whether a character is
BasicHeaderValueFormatter.UNSAFE_CHARS unsafe . |
DEFAULT | final public static BasicHeaderValueFormatter DEFAULT(Code) | | A default instance of this class, for use as default or fallback.
Note that
BasicHeaderValueFormatter 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.
|
SEPARATORS | final public static String SEPARATORS(Code) | | Special characters that can be used as separators in HTTP parameters.
These special characters MUST be in a quoted string to be used within
a parameter value .
|
UNSAFE_CHARS | final public static String UNSAFE_CHARS(Code) | | Unsafe special characters that must be escaped using the backslash
character
|
doFormatValue | protected void doFormatValue(CharArrayBuffer buffer, String value, boolean quote)(Code) | | Actually formats the value of a name-value pair.
This does not include a leading = character.
Called from
BasicHeaderValueFormatter.formatNameValuePair formatNameValuePair .
Parameters: buffer - the buffer to append to, never null Parameters: value - the value to append, never null Parameters: quote - true to always format with quotes,false to use quotes only when necessary |
estimateElementsLen | protected int estimateElementsLen(HeaderElement[] elems)(Code) | | Estimates the length of formatted header elements.
Parameters: elems - the header elements to format, or null a length estimate, in number of characters |
estimateHeaderElementLen | protected int estimateHeaderElementLen(HeaderElement elem)(Code) | | Estimates the length of a formatted header element.
Parameters: elem - the header element to format, or null a length estimate, in number of characters |
estimateNameValuePairLen | protected int estimateNameValuePairLen(NameValuePair nvp)(Code) | | Estimates the length of a formatted name-value pair.
Parameters: nvp - the name-value pair to format, or null a length estimate, in number of characters |
estimateParametersLen | protected int estimateParametersLen(NameValuePair[] nvps)(Code) | | Estimates the length of formatted parameters.
Parameters: nvps - the parameters to format, or null a length estimate, in number of characters |
formatElements | final public static String formatElements(HeaderElement[] elems, boolean quote, HeaderValueFormatter formatter)(Code) | | Formats an array of header elements.
Parameters: elems - the header elements to format Parameters: quote - true to always format with quoted values,false to use quotes only when necessary Parameters: formatter - the formatter to use, or null for the BasicHeaderValueFormatter.DEFAULT default the formatted header elements |
formatHeaderElement | final public static String formatHeaderElement(HeaderElement elem, boolean quote, HeaderValueFormatter formatter)(Code) | | Formats a header element.
Parameters: elem - the header element to format Parameters: quote - true to always format with quoted values,false to use quotes only when necessary Parameters: formatter - the formatter to use, or null for the BasicHeaderValueFormatter.DEFAULT default the formatted header element |
formatNameValuePair | final public static String formatNameValuePair(NameValuePair nvp, boolean quote, HeaderValueFormatter formatter)(Code) | | Formats a name-value pair.
Parameters: nvp - the name-value pair to format Parameters: quote - true to always format with a quoted value,false to use quotes only when necessary Parameters: formatter - the formatter to use, or null for the BasicHeaderValueFormatter.DEFAULT default the formatted name-value pair |
formatParameters | final public static String formatParameters(NameValuePair[] nvps, boolean quote, HeaderValueFormatter formatter)(Code) | | Formats a set of parameters.
Parameters: nvps - the parameters to format Parameters: quote - true to always format with quoted values,false to use quotes only when necessary Parameters: formatter - the formatter to use, or null for the BasicHeaderValueFormatter.DEFAULT default the formatted parameters |
isSeparator | protected boolean isSeparator(char ch)(Code) | | Checks whether a character is a
BasicHeaderValueFormatter.SEPARATORS separator .
Parameters: ch - the character to check true if the character is a separator,false otherwise |
|
|