|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.acorn.http.HttpParser
public abstract class HttpParser
A static HTTP header parser. As HTTP data should be 8-bit stuff, we don't use encodings to gain best performance.
| Nested Class Summary | |
|---|---|
static class |
HttpParser.ParsedState
A state holder for the parser. |
| Field Summary | |
|---|---|
static String |
ACCEPT
Accept request header. |
static String |
ACCEPT_CHARSET
Accept-Charset request header. |
static String |
ACCEPT_LANGUAGE
Accept-Language request header. |
static String |
ACCEPT_RANGES
Accept-Ranges response header. |
static String |
AUTHENTICATE
WWW-Authenticate response header. |
static String |
AUTHORIZATION
Authorization request header. |
static String |
CACHE_CONTROL
Cache-Control header. |
static String |
CONNECTION
Connection header. |
static String |
CONTENT_DISPOSITION
Content-Disposition content header. |
static String |
CONTENT_ENCODING
Content-Encoding content header. |
static String |
CONTENT_LANGUAGE
Content-Language content header. |
static String |
CONTENT_LENGTH
Content-Length content header. |
static String |
CONTENT_TYPE
Content-Type content header. |
static String |
CONTEXT_URL
Contect-URL pragma. |
static String |
COOKIE
Cookie request header. |
static String |
DATE
Date header. |
static String |
DEFAULT_PROVIDER
The default provider. |
static String |
DELETE
Delete method. |
static String |
DOCTYPE_HTML_4_01
HTML doctype. |
static String |
DOCTYPE_WML_1_1
WML doctype. |
static String |
DOCTYPE_XHTML_1_0
XHTML doctype. |
static String |
DURATION
Duration access log comment. |
static String |
EXPECT
Expect request header. |
static String |
EXPECT_100_CONTINUE
100-Continue expect header value. |
static String |
EXPIRES
Expires entity header. |
static String |
FORM_DATA
Form-Data- Content-Disposition parameter. |
static String |
FORM_DATA_FILENAME
Form-Data-Filename Content-Disposition parameter. |
static String |
FORM_DATA_NAME
Form-Data-Name Content-Disposition parameter. |
static String |
FORM_DATA_TYPE
Form-Data-Type Content-Disposition parameter. |
static String |
FORM_LOGIN_ACTION
Login action (Servlet API 2.3). |
static String |
FORM_LOGIN_PASSWORD
Login password (Servlet API 2.3). |
static String |
FORM_LOGIN_PATH
Login path. |
static String |
FORM_LOGIN_REMEMBER
Remember login. |
static String |
FORM_LOGIN_USERNAME
Login username (Servlet API 2.3). |
static String |
GENERIC_USER_AGENT
The generic user agent. |
static String |
GET
Get method. |
static String |
HEAD
Head method. |
static String |
HOST
Host request header. |
static String |
HTTP
HTTP protocol. |
static int |
HTTP_PORT
HTTP port. |
static String |
HTTP_REDIRECTION
The redirection URI path parameter. |
static String |
HTTP_REQUEST
Http-Request access log comment. |
static String |
HTTP_SESSION_COOKIE
The session id cookie (servlet API 2.3). |
static String |
HTTP_SESSION_ID
The session id URI path parameter (servlet API 2.3). |
static String |
HTTPS
HTTPS protocol. |
static int |
HTTPS_PORT
HTTPS port. |
static String |
IF_MODIFIED_SINCE
If-Modified-Since entity header. |
static String |
IF_UNMODIFIED_SINCE
If-Unmodified-Since entity header. |
static String |
IS_SECURE
Is-Secure pragma. |
static String |
LAST_MODIFIED
Last-Modified entity header. |
static String |
LOCAL_ADDR
Local address. |
static String |
LOCAL_HOST
Local host. |
static String |
LOCATION
Location response header. |
static String |
NO_CACHE
No caching (HTTP 1.0). |
static String |
NO_CACHE_CONTROL
No caching (HTTP 1.1). |
static int |
OK
The OK status. |
static String |
OK_RESPONSE
The OK message. |
static String |
OPTIONS
Options method. |
static String |
POST
Post method. |
static String |
PRAGMA
Pragma header. |
static String |
PRIVATE_CACHE_CONTROL
Private caching (HTTP 1.1). |
static String |
PUT
Put method. |
static int |
RAW
0 Raw. |
static String |
REFERER
Referer request header. |
static String |
REMOTE_ADDR
Remote-Addr pragma. |
static String |
REMOTE_HOST
Remote-Host access log comment. |
static String |
REMOTE_USER
Remote-User access log comment. |
static String |
RFC931_USER
RFC931-User access log comment. |
static String |
SERVER
Server response header. |
static String |
SERVER_INFO
Server info. |
static String |
SERVER_PORT
Server-Port pragma. |
static String |
SET_COOKIE
Set-Cookie response header. |
static String |
STATUS
Status response header. |
static String |
TRACE
Trace method. |
static String |
TRAILER
Trailer header. |
static String |
TRANSFER_ENCODING
Transfer-Encoding header. |
static String |
UNAUTHENTICATED
Unauthenticated. |
static String |
UPGRADE
Upgrade header. |
static String |
USER_AGENT
User-Agent request header. |
static String |
VERSION_INFO
Version info. |
static String |
VIA
Via header. |
static String |
WARNING
Warning header. |
static String |
XHTML_XMLNS
XMLNS attribute. |
| Constructor Summary | |
|---|---|
HttpParser()
|
|
| Method Summary | |
|---|---|
static String |
getDate(long date)
Gets a MIME date. |
protected static char[] |
getLine(InputStream in,
HttpParser.ParsedState ps,
int max)
Gets the next line buffer from an input stream. |
static String |
getMessage(int code)
Gets the standard message for a status code. |
static String |
parseCharacterEncoding(String str)
Parses the character encoding of a header string. |
static String |
parseCharacterEncoding(String str,
String enc)
Parses the character encoding of a header string with a default. |
static List |
parseCharSets(Enumeration headers)
Parses charsets from headers. |
static List |
parseContentTypes(Enumeration headers)
Parses MIME type strings from headers. |
static long |
parseDate(String str)
Parses the date of a header string. |
static Map |
parseHeaders(InputStream in)
Parses the headers of an input stream. |
static void |
parseHeaders(InputStream in,
Map headers)
Parses the headers of an input stream. |
protected static List |
parseHeaderValues(Enumeration headers,
boolean params)
Parses sorted values from headers. |
static List |
parseLocales(Enumeration headers)
Parses locales from header values. |
static List |
parseMimeTypes(Enumeration headers)
Parses MIME types from headers. |
static float |
parseProtocol(String str)
Parses the protocol. |
protected static void |
parseRequest(char[] buf,
HttpParser.ParsedState ps,
List request)
Parses the request from a char array. |
static List |
parseRequest(InputStream in)
Parses the request from an input stream. |
static List |
parseRequest(InputStream in,
int maxLength)
Parses the request from an input stream. |
static void |
parseRequest(InputStream in,
List request,
int maxLength)
Parses the request from an input stream. |
static List |
parseRequest(String str)
Parses the request from a string. |
static void |
parseRequest(String str,
List request)
Parses the request from a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_PROVIDER
public static final String GENERIC_USER_AGENT
public static final String HTTP
public static final String HTTPS
public static final String LOCAL_HOST
public static final String LOCAL_ADDR
public static final int HTTP_PORT
public static final int HTTPS_PORT
public static final String GET
public static final String PUT
public static final String POST
public static final String HEAD
public static final String TRACE
public static final String DELETE
public static final String OPTIONS
public static final String CACHE_CONTROL
public static final String CONNECTION
public static final String DATE
public static final String PRAGMA
public static final String TRAILER
public static final String UPGRADE
public static final String VIA
public static final String WARNING
public static final String TRANSFER_ENCODING
public static final String ACCEPT
public static final String ACCEPT_CHARSET
public static final String ACCEPT_LANGUAGE
public static final String AUTHORIZATION
public static final String COOKIE
public static final String EXPECT
public static final String EXPECT_100_CONTINUE
public static final String HOST
public static final String REFERER
public static final String USER_AGENT
public static final String ACCEPT_RANGES
public static final String AUTHENTICATE
public static final String LOCATION
public static final String SERVER
public static final String SET_COOKIE
public static final String STATUS
public static final String EXPIRES
public static final String IF_MODIFIED_SINCE
public static final String IF_UNMODIFIED_SINCE
public static final String LAST_MODIFIED
public static final String CONTENT_DISPOSITION
public static final String CONTENT_ENCODING
public static final String CONTENT_LANGUAGE
public static final String CONTENT_LENGTH
public static final String CONTENT_TYPE
public static final String HTTP_REQUEST
public static final String REMOTE_HOST
public static final String RFC931_USER
public static final String REMOTE_USER
public static final String DURATION
public static final String FORM_DATA
public static final String FORM_DATA_TYPE
public static final String FORM_DATA_NAME
public static final String FORM_DATA_FILENAME
public static final String SERVER_INFO
public static final String VERSION_INFO
public static final String HTTP_SESSION_COOKIE
public static final String HTTP_SESSION_ID
public static final String HTTP_REDIRECTION
public static final String DOCTYPE_HTML_4_01
public static final String DOCTYPE_XHTML_1_0
public static final String DOCTYPE_WML_1_1
public static final String XHTML_XMLNS
public static final String NO_CACHE
public static final String NO_CACHE_CONTROL
public static final String PRIVATE_CACHE_CONTROL
public static final String CONTEXT_URL
public static final String SERVER_PORT
public static final String REMOTE_ADDR
public static final String IS_SECURE
public static final String FORM_LOGIN_PATH
public static final String FORM_LOGIN_REMEMBER
public static final String FORM_LOGIN_USERNAME
public static final String FORM_LOGIN_PASSWORD
public static final String FORM_LOGIN_ACTION
public static final String UNAUTHENTICATED
public static final int RAW
public static final int OK
public static final String OK_RESPONSE
| Constructor Detail |
|---|
public HttpParser()
| Method Detail |
|---|
public static final List parseRequest(InputStream in)
throws IOException
in - an input stream.
IOException - for I/O errors.
IllegalArgumentException - for parsing errors.
public static final List parseRequest(InputStream in,
int maxLength)
throws IOException
in - an input stream.maxLength - the maximum length of the parsed line.
IOException - for I/O errors.
IllegalArgumentException - for parsing errors.
public static final void parseRequest(InputStream in,
List request,
int maxLength)
throws IOException
in - an input stream.request - a list for the result.maxLength - the maximum length of the parsed line.
IOException - for I/O errors.
IllegalArgumentException - for parsing errors.public static final List parseRequest(String str)
str - the string to parse.
IllegalArgumentException - for parsing errors.
public static final void parseRequest(String str,
List request)
str - the string to parse.request - a list for the result.
IllegalArgumentException - for parsing errors.
public static final Map parseHeaders(InputStream in)
throws IOException
in - an input stream.
IOException - for I/O errors.
IllegalArgumentException - for parsing errors.
public static final void parseHeaders(InputStream in,
Map headers)
throws IOException
in - an input stream.headers - a map for the result.
IOException - for I/O errors.
IllegalArgumentException - for parsing errors.public static final float parseProtocol(String str)
str - a protocol string to parse.
NumberFormatException - for parsing errors.public static final List parseLocales(Enumeration headers)
headers - an enumeration of header values.
IllegalArgumentException - for parsing errors.public static final List parseCharSets(Enumeration headers)
headers - an enumeration of header values.
IllegalArgumentException - for parsing errors.public static final String parseCharacterEncoding(String str)
str - a header string.
public static final String parseCharacterEncoding(String str,
String enc)
str - a header string.enc - an optional default encoding.
public static final long parseDate(String str)
str - a header string.
public static final List parseContentTypes(Enumeration headers)
headers - an enumeration of header values.
IllegalArgumentException - for parsing errors.public static final List parseMimeTypes(Enumeration headers)
headers - an enumeration of header values.
IllegalArgumentException - for parsing errors.public static final String getDate(long date)
date - a date in msecs.
public static final String getMessage(int code)
code - a code to get.
protected static final void parseRequest(char[] buf,
HttpParser.ParsedState ps,
List request)
buf - the char array to parse.ps - the parsed state to apply.request - a list for the result.
IllegalArgumentException - for parsing errors.
protected static final List parseHeaderValues(Enumeration headers,
boolean params)
headers - an enumeration of header values.params - a flag to include parameters.
IllegalArgumentException - for parsing errors.
protected static final char[] getLine(InputStream in,
HttpParser.ParsedState ps,
int max)
throws IOException
in - an input stream.ps - a parsed state.max - the maximum accepted length.
IOException - on I/O errors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||