|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.netseeker.ejoe.http.HttpHeaderParser
public class HttpHeaderParser
This is the main HTTP header parser of EJOE. It's able to validate an ByteBuffer if it contains a valid HTTP header and can detect:
Field Summary | |
---|---|
protected static java.nio.charset.Charset |
csISO
|
protected static java.lang.String |
LINE_SEP
|
protected static java.util.regex.Pattern |
pConnection
|
protected static java.util.regex.Pattern |
pContentLength
|
protected static java.util.regex.Pattern |
pLineEnd
|
Constructor Summary | |
---|---|
protected |
HttpHeaderParser(java.nio.ByteBuffer buf)
Hidden constructor, only child classes are permitted to create a new instance |
Method Summary | |
---|---|
protected int |
extractContentLength()
Determines the length of the expected content as stated in the "Content-Length:" section of the header |
protected static int |
extractHeaderLength(java.nio.ByteBuffer bb)
Searches the ByteBuffer for two line breaks (either "\r\n\r\n" or "\n\n") to detect the end of HTTP header data |
java.nio.ByteBuffer |
getByteHeader()
|
java.nio.CharBuffer |
getCharHeader()
|
int |
getContentLength()
Returns the content length |
int |
getHeaderLength()
Returns the length of the HTTP header in bytes without any preread content |
boolean |
hasCompression()
Returns the compression setting in the HTTP-Header. |
boolean |
hasPrereadContent()
|
static boolean |
isComplete(java.nio.ByteBuffer bb)
Checks if the HTTP is complete. |
protected boolean |
isConnectionPersistent()
Checks if the client has requested a persistent connection |
boolean |
isPersistentConnection()
Indicates whether the value for the HTTP header line "Connection:" was "close" or "open". |
boolean |
isValid()
Checks if the HTTP header seems to be valid |
protected void |
setCompression(boolean enable)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String LINE_SEP
protected static final java.nio.charset.Charset csISO
protected static final java.util.regex.Pattern pLineEnd
protected static final java.util.regex.Pattern pContentLength
protected static final java.util.regex.Pattern pConnection
Constructor Detail |
---|
protected HttpHeaderParser(java.nio.ByteBuffer buf)
buf
- ByteBuffer expected to contain a HTTP header [ + optional preread content ]Method Detail |
---|
public int getContentLength()
public int getHeaderLength()
public boolean isValid()
public java.nio.CharBuffer getCharHeader()
public java.nio.ByteBuffer getByteHeader()
public boolean hasPrereadContent()
public boolean isPersistentConnection()
public boolean hasCompression()
protected void setCompression(boolean enable)
protected int extractContentLength()
protected boolean isConnectionPersistent()
protected static int extractHeaderLength(java.nio.ByteBuffer bb)
bb
- ByteBuffer containing HTTP header data
public static boolean isComplete(java.nio.ByteBuffer bb)
bb
- ByteBuffer containing HTTP header data
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |