Package kilim.http
Class HttpRequest
java.lang.Object
kilim.http.HttpMsg
kilim.http.HttpRequest
This object encapsulates a bytebuffer (via HttpMsg). HttpRequestParser creates an instance of this object, but only
converts a few of the important fields into Strings; the rest are maintained as ranges (offset + length) in the
bytebuffer. Use
getHeader(String) to get the appropriate field.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byteintintstatic byteintThe read cursor, used in the read* methods.String[]Keys present in the HTTP headerstatic byteThe original header.intint(package private) static final byteintThe UTF8 decoded path from the HTTP header.int[]int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddumpBuffer(ByteBuffer buffer) byte[]extractBytes(int beg, int end) extractRange(int range) extractRange(int beg, int end) voidGet the value for a given keygetQuery()booleanbooleanstatic intparseChunkSize(ByteBuffer buffer, int start, int end) voidreadAllChunks(EndPoint endpoint) voidvoidvoidreadHeader(EndPoint endpoint) intvoidreadTrailers(EndPoint endpoint) voidreuse()Clear the request object so that it can be reused for the next message.toString()version()
-
Field Details
-
method
The original header. All string variables that pertain to the message's header are either subsequences of this header, or interned (all known keywords). -
uriPath
The UTF8 decoded path from the HTTP header. -
nFields
public int nFields -
keys
Keys present in the HTTP header -
versionRange
public int versionRange -
uriFragmentRange
public int uriFragmentRange -
queryStringRange
public int queryStringRange -
valueRanges
public int[] valueRanges -
contentOffset
public int contentOffset -
contentLength
public int contentLength -
iread
public int ireadThe read cursor, used in the read* methods. -
CR
public static byte CR -
LF
public static byte LF -
b0
static final byte b0- See Also:
-
b9
static final byte b9- See Also:
-
ba
static final byte ba- See Also:
-
bf
static final byte bf- See Also:
-
bA
static final byte bA- See Also:
-
bF
static final byte bF- See Also:
-
SEMI
static final byte SEMI- See Also:
-
-
Constructor Details
-
HttpRequest
public HttpRequest()
-
-
Method Details
-
getHeader
Get the value for a given key- Parameters:
key-- Returns:
- null if the key is not present in the header.
-
getQuery
- Returns:
- the query part of the URI.
-
version
-
keepAlive
public boolean keepAlive() -
getQueryComponents
-
getQueryComponents
-
uriFragment
-
toString
-
isOldHttp
public boolean isOldHttp()- Returns:
- true if version is 1.0 or earlier
-
reuse
public void reuse()Clear the request object so that it can be reused for the next message. -
readFrom
- Throws:
PausableIOException
-
readHeader
- Throws:
PausableIOException
-
dumpBuffer
-
addField
-
extractRange
-
extractRange
-
extractBytes
public byte[] extractBytes(int beg, int end) -
readBody
- Throws:
PausableIOException
-
readTrailers
-
readAllChunks
- Throws:
IOExceptionPausable
-
parseChunkSize
- Throws:
IOException
-
fill
- Throws:
IOExceptionPausable
-
readLine
- Throws:
IOExceptionPausable
-