This parser parses HTTP client and server messages from buffers
passed in the parseNext(ByteBuffer) method. The parsed
elements of the HTTP message are passed as event calls to the
HttpHandler instance the parser is constructed with.
If the passed handler is a RequestHandler then server side
parsing is performed and if it is a ResponseHandler, then
client side parsing is done.
The contract of the HttpHandler API is that if a call returns
true then the call to parseNext(ByteBuffer) will return as
soon as possible also with a true response. Typically this indicates
that the parsing has reached a stage where the caller should process
the events accumulated by the handler. It is the preferred calling
style that handling such as calling a servlet to process a request,
should be done after a true return from parseNext(ByteBuffer)
rather than from within the scope of a call like
RequestHandler#messageComplete()
For performance, the parse is heavily dependent on the
Index#getBest(ByteBuffer, int, int) method to look ahead in a
single pass for both the structure ( : and CRLF ) and semantic (which
header and value) of a header. Specifically the static HttpHeader#CACHE
is used to lookup common combinations of headers and values
(eg. "Connection: close"), or just header names (eg. "Connection:" ).
For headers who's value is not known statically (eg. Host, COOKIE) then a
per parser dynamic Trie of HttpFields from previous parsed messages
is used to help the parsing of subsequent messages.
The parser can work in varying compliance modes:
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static enum | |
| public static interface | |
| private static class | |
| public static interface | |
| public static interface | |
| public static enum |
| Modifier and Type | Field and Description |
|---|---|
| private static final EnumSet | |
| private static final EnumSet | |
| private static final EnumSet | |
| private long | |
| private int | |
| private int | |
| private final HttpCompliance | |
| private ByteBuffer | |
| private long | |
| private long | |
| private boolean | |
| private HttpTokens. | |
| private volatile boolean | |
| private HttpField | |
| private final HttpParser. | |
| private volatile HttpParser. | |
| private final HttpParser. | |
| private boolean | |
| private boolean | |
| private HttpHeader | |
| private int | |
| private boolean | |
| private String | |
| private boolean | |
| private int | |
| private final int | |
| private HttpMethod | |
| private String | |
| private String | |
| private final HttpParser. | |
| private final HttpParser. | |
| private int | |
| private volatile HttpParser. | |
| private final StringBuilder | |
| private final Utf8StringBuilder | |
| private String | |
| private HttpVersion | |
| public static final Index | |
| private final boolean | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| public static final int | |
| private static final int | |
| public static final Logger | |
| private static final int | |
| private static final Index. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| private | HttpParser(HttpParser.
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected void | |
| protected String | |
| private void | |
| protected void | |
| public void | |
| private static HttpCompliance | |
| private long | |
| public long | |
| public long | |
| public long | |
| public Index | |
| public HttpParser. | |
| public int | |
| public int | |
| public HttpParser. | |
| private boolean | |
| private boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| private HttpTokens. | |
| protected boolean | |
| private void | |
| private void | |
| protected boolean | |
| private boolean | |
| public boolean | Returns: True if anRequestHandler method was called and it returned true;the buffer to parse buffer)Parse until next Event. |
| private void | |
| protected void | |
| protected void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| protected void | |
| protected void | |
| protected void | |
| private void | |
| private String | |
| public String |