com.meterware.httpunit

Class HttpUnitUtils

public class HttpUnitUtils extends Object

Utility code shared by httpunit and servletunit.
Field Summary
static intDEFAULT_BUFFER_SIZE
static StringDEFAULT_CHARACTER_SET
static intDEFAULT_TEXT_BUFFER_SIZE
Method Summary
static Stringdecode(String byteString)
Returns an interpretation of the specified URL-encoded string, using the iso-8859-1 character set.
static Stringdecode(String string, String charset)
Decodes a URL safe string into its original form using the specified character set.
static DocumentBuildernewParser()
creates a parser using JAXP API.
static String[]parseContentTypeHeader(String header)
Returns the content type and encoding as a pair of strings.
static StringstripQuotes(String value)

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE

DEFAULT_CHARACTER_SET

public static final String DEFAULT_CHARACTER_SET

DEFAULT_TEXT_BUFFER_SIZE

public static final int DEFAULT_TEXT_BUFFER_SIZE

Method Detail

decode

public static String decode(String byteString)
Returns an interpretation of the specified URL-encoded string, using the iso-8859-1 character set.

Since: 1.6

decode

public static String decode(String string, String charset)
Decodes a URL safe string into its original form using the specified character set. Escaped characters are converted back to their original representation. This method is copied from the Jakarta Commons Codec; org.apache.commons.codec.net.URLCodec class.

Parameters: string URL safe string to convert into its original form

Returns: original string

Throws: IllegalArgumentException thrown if URL decoding is unsuccessful,

newParser

public static DocumentBuilder newParser()
creates a parser using JAXP API.

parseContentTypeHeader

public static String[] parseContentTypeHeader(String header)
Returns the content type and encoding as a pair of strings. If no character set is specified, the second entry will be null.

stripQuotes

public static String stripQuotes(String value)