|
||||||||||
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 java.lang.Appendable |
appendComment(java.lang.CharSequence source,
java.lang.Appendable destination)
Appends a source string as an HTTP comment. |
static java.lang.Appendable |
appendQuote(java.lang.CharSequence source,
java.lang.Appendable destination)
Appends a source string as an HTTP quoted string. |
static java.lang.Appendable |
appendUriEncoded(java.lang.CharSequence source,
java.lang.Appendable destination,
CharacterSet characterSet)
Appends a source string as an URI encoded string. |
static Parameter |
createParameter(java.lang.CharSequence name,
java.lang.CharSequence value)
Creates a parameter. |
static java.lang.String |
createVaryHeader(java.util.Collection<Dimension> dimensions)
Creates a vary header from the given dimensions. |
static void |
formatProduct(java.lang.CharSequence nameToken,
java.lang.CharSequence versionToken,
java.lang.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(java.lang.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(java.io.InputStream is,
java.lang.StringBuilder sb)
Read a header. |
static void |
writeCRLF(java.io.OutputStream os)
Writes a new line. |
static void |
writeHeader(Parameter header,
java.io.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 java.lang.Appendable appendComment(java.lang.CharSequence source, java.lang.Appendable destination) throws java.io.IOException
source
- The source string to format.destination
- The appendable destination.
java.io.IOException
public static java.lang.Appendable appendQuote(java.lang.CharSequence source, java.lang.Appendable destination) throws java.io.IOException
source
- The unquoted source string.destination
- The destination to append to.
java.io.IOException
public static java.lang.Appendable appendUriEncoded(java.lang.CharSequence source, java.lang.Appendable destination, CharacterSet characterSet) throws java.io.IOException
source
- The source string to format.destination
- The appendable destination.characterSet
- The supported character encoding.
java.io.IOException
public static Parameter createParameter(java.lang.CharSequence name, java.lang.CharSequence value)
name
- The parameter name buffer.value
- The parameter value buffer (can be null).
java.io.IOException
public static java.lang.String createVaryHeader(java.util.Collection<Dimension> dimensions)
dimensions
- The dimensions to copy to the response.
public static void formatProduct(java.lang.CharSequence nameToken, java.lang.CharSequence versionToken, java.lang.Appendable destination) throws java.io.IOException
nameToken
- The product name token.versionToken
- The product version token.destination
- The appendable destination;
java.io.IOException
public 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(java.lang.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(java.io.InputStream is, java.lang.StringBuilder sb) throws java.io.IOException
is
- The message input stream.sb
- The string builder to reuse.
java.io.IOException
public static void writeCRLF(java.io.OutputStream os) throws java.io.IOException
os
- The output stream.
java.io.IOException
public static void writeHeader(Parameter header, java.io.OutputStream os) throws java.io.IOException
header
- The header to write.os
- The output stream.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |