|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.noelios.restlet.http.HttpUtils
public class HttpUtils
Various HTTP utilities.
| Constructor Summary | |
|---|---|
HttpUtils()
|
|
| Method Summary | |
|---|---|
static Appendable |
appendComment(CharSequence source,
Appendable destination)
Appends a source string as an HTTP comment. |
static Appendable |
appendQuote(CharSequence source,
Appendable destination)
Appends a source string as an HTTP quoted string. |
static Appendable |
appendUriEncoded(CharSequence source,
Appendable destination,
CharacterSet characterSet)
Appends a source string as an URI encoded string. |
static Parameter |
createParameter(CharSequence name,
CharSequence value)
Creates a parameter. |
static String |
createVaryHeader(Collection<Dimension> dimensions)
Creates a vary header from the given dimensions. |
static void |
formatProduct(CharSequence nameToken,
CharSequence versionToken,
Appendable destination)
Formats a product description. |
static boolean |
isAlpha(int character)
Indicates if the given character is alphabetical (a-z or A-Z). |
static boolean |
isAsciiChar(int character)
Indicates if the given character is in ASCII range. |
static boolean |
isCarriageReturn(int character)
Indicates if the given character is a carriage return. |
static boolean |
isControlChar(int character)
Indicates if the given character is a control character. |
static boolean |
isDigit(int character)
Indicates if the given character is a digit (0-9). |
static boolean |
isDoubleQuote(int character)
Indicates if the given character is a double quote. |
static boolean |
isHorizontalTab(int character)
Indicates if the given character is an horizontal tab. |
static boolean |
isLineFeed(int character)
Indicates if the given character is a line feed. |
static boolean |
isLowerCase(int character)
Indicates if the given character is lower case (a-z). |
static boolean |
isSeparator(int character)
Indicates if the given character is a separator. |
static boolean |
isSpace(int character)
Indicates if the given character is a space. |
static boolean |
isText(int character)
Indicates if the given character is textual (ASCII and not a control character). |
static boolean |
isToken(CharSequence token)
Indicates if the token is valid. Only contains valid token characters. |
static boolean |
isTokenChar(int character)
Indicates if the given character is a token character (text and not a separator). |
static boolean |
isUpperCase(int character)
Indicates if the given character is upper case (A-Z). |
static Parameter |
readHeader(InputStream is,
StringBuilder sb)
Read a header. |
static void |
writeCRLF(OutputStream os)
Writes a new line. |
static void |
writeHeader(Parameter header,
OutputStream os)
Writes a header line. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpUtils()
| Method Detail |
|---|
public static Appendable appendComment(CharSequence source,
Appendable destination)
throws IOException
source - The source string to format.destination - The appendable destination.
IOException
public static Appendable appendQuote(CharSequence source,
Appendable destination)
throws IOException
source - The unquoted source string.destination - The destination to append to.
IOException
public static Appendable appendUriEncoded(CharSequence source,
Appendable destination,
CharacterSet characterSet)
throws IOException
source - The source string to format.destination - The appendable destination.characterSet - The supported character encoding.
IOException
public static Parameter createParameter(CharSequence name,
CharSequence value)
name - The parameter name buffer.value - The parameter value buffer (can be null).
IOExceptionpublic static String createVaryHeader(Collection<Dimension> dimensions)
dimensions - The dimensions to copy to the response.
public static void formatProduct(CharSequence nameToken,
CharSequence versionToken,
Appendable destination)
throws IOException
nameToken - The product name token.versionToken - The product version token.destination - The appendable destination;
IOExceptionpublic static boolean isAlpha(int character)
character - The character to test.
public static boolean isAsciiChar(int character)
character - The character to test.
public static boolean isCarriageReturn(int character)
character - The character to test.
public static boolean isControlChar(int character)
character - The character to test.
public static boolean isDigit(int character)
character - The character to test.
public static boolean isDoubleQuote(int character)
character - The character to test.
public static boolean isHorizontalTab(int character)
character - The character to test.
public static boolean isLineFeed(int character)
character - The character to test.
public static boolean isLowerCase(int character)
character - The character to test.
public static boolean isSeparator(int character)
character - The character to test.
public static boolean isSpace(int character)
character - The character to test.
public static boolean isText(int character)
character - The character to test.
public static boolean isToken(CharSequence token)
token - The token to check
public static boolean isTokenChar(int character)
character - The character to test.
public static boolean isUpperCase(int character)
character - The character to test.
public static Parameter readHeader(InputStream is,
StringBuilder sb)
throws IOException
is - The message input stream.sb - The string builder to reuse.
IOException
public static void writeCRLF(OutputStream os)
throws IOException
os - The output stream.
IOException
public static void writeHeader(Parameter header,
OutputStream os)
throws IOException
header - The header to write.os - The output stream.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||