public class HttpUtils
extends java.lang.Object
Constructor and Description |
---|
HttpUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
parseHeaderStream(java.io.InputStream is, java.util.Hashtable<java.lang.String,java.lang.String> headers, java.util.Vector<java.lang.String> keys)
Reads HTTP headers from the given input stream, parses them and puts the resulting keys and values into the given Hashtable and Vector objects.
|
static java.lang.String |
readCanonicalLine(java.io.InputStream in) |
static boolean |
requiresSingleValue(java.lang.String header)
Checks whether the given HTTP header is required to have at most one value in a single message.
|
static java.lang.String |
toTitleCase(java.lang.String s) |
public static java.lang.String readCanonicalLine(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static java.lang.String toTitleCase(java.lang.String s)
public static void parseHeaderStream(java.io.InputStream is, java.util.Hashtable<java.lang.String,java.lang.String> headers, java.util.Vector<java.lang.String> keys) throws java.io.IOException
is
- An input stream positioned at the beginning of the headers.headers
- A hashtable to contain the parsed header keys and values.keys
- A vector to contain the parsed header keys (to preserve the order of the headers). If null
, the order in which the headers were read is lost.java.io.IOException
public static boolean requiresSingleValue(java.lang.String header)
header
- The string name of the HTTP header to check.true
if the given header must have at most one value; false
if the header may have more than one value, or if the header is unrecognized.