org.jwall.web.http.nio
Class HttpRequestChannel
java.lang.Object
org.jwall.web.http.nio.HttpMessageChannel<HttpRequest>
org.jwall.web.http.nio.HttpRequestChannel
public class HttpRequestChannel
- extends HttpMessageChannel<HttpRequest>
$Id: HttpRequestStream.java 79 2007-10-22 23:43:37Z chris $
This class implements a reader which reads from the input-stream
and parses http-requests. The requests are queued and can be fetched
by getRequest().
- Author:
- chris@jwall.org
TIMEOUT_PROPERTY
public static final String TIMEOUT_PROPERTY
- See Also:
- Constant Field Values
log
public static org.slf4j.Logger log
HttpRequestChannel
public HttpRequestChannel(ReadableByteChannel in)
throws IOException
- Creates a HttpRequestStream which parses requests from the given input-stream.
The
cid-string is used for logging.
- Parameters:
in -
- Throws:
IOException
HttpRequestChannel
public HttpRequestChannel(InputStream in)
throws IOException
- Throws:
IOException
readMessage
public HttpRequest readMessage()
throws TimeOutException,
IOException,
ProtocolException
- Specified by:
readMessage in class HttpMessageChannel<HttpRequest>
- Throws:
TimeOutException
IOException
ProtocolException
readRequest
public HttpRequest readRequest()
throws TimeOutException,
IOException,
ProtocolException
- This method returns the next complete request in the input-stream.
The result is an array which has size 1 most of the time, but can
be of size 2, if the request has a body.
In this case, the body is returned as the second element in the array.
- Returns:
- A string array consisting of a request-header and possibly a
request-body element.
- Throws:
TimeOutException
IOException
ProtocolException
close
public void close()
throws IOException
- Description copied from class:
HttpMessageChannel
- This method closes the message-channel and also closes the
underlying byte-channel.
- Overrides:
close in class HttpMessageChannel<HttpRequest>
- Throws:
IOException - In case closing the underlying byte-channel
resulted in an I/O error.
getNumberOfRequests
public int getNumberOfRequests()
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2012 jwall.org. All Rights Reserved.