public class HttpChannel<T> extends Object implements HttpParser.RequestHandler<T>, Runnable
| Constructor and Description |
|---|
HttpChannel(Connector connector,
HttpConfiguration configuration,
EndPoint endPoint,
HttpTransport transport,
HttpInput<T> input) |
| Modifier and Type | Method and Description |
|---|---|
void |
badMessage(int status,
String reason) |
protected boolean |
commitResponse(HttpGenerator.ResponseInfo info,
ByteBuffer content,
boolean complete) |
boolean |
content(T item) |
void |
continue100(int available)
If the associated response has the Expect header set to 100 Continue,
then accessing the input stream indicates that the handler/servlet
is ready for the request body and thus a 100 Continue response is sent.
|
boolean |
earlyEOF() |
protected void |
execute(Runnable task) |
ByteBufferPool |
getByteBufferPool() |
Connector |
getConnector() |
static HttpChannel<?> |
getCurrentHttpChannel() |
EndPoint |
getEndPoint() |
int |
getHeaderCacheSize() |
HttpConfiguration |
getHttpConfiguration() |
HttpVersion |
getHttpVersion() |
InetSocketAddress |
getLocalAddress() |
InetSocketAddress |
getRemoteAddress() |
Request |
getRequest() |
int |
getRequests() |
Response |
getResponse() |
Scheduler |
getScheduler() |
Server |
getServer() |
HttpChannelState |
getState() |
protected void |
handleException(Throwable x)
Sends an error 500, performing a special logic to detect whether the request is suspended,
to avoid concurrent writes from the application.
|
boolean |
headerComplete() |
protected boolean |
isCommitted() |
boolean |
isExpecting100Continue() |
boolean |
isExpecting102Processing() |
boolean |
messageComplete() |
boolean |
parsedHeader(HttpField field) |
boolean |
parsedHostHeader(String host,
int port) |
void |
reset() |
void |
run() |
protected static void |
setCurrentHttpChannel(HttpChannel<?> channel) |
boolean |
startRequest(HttpMethod httpMethod,
String method,
ByteBuffer uri,
HttpVersion version) |
String |
toString() |
protected void |
write(ByteBuffer content,
boolean complete)
Requests to write (in a blocking way) the given response content buffer,
committing the response if needed.
|
public HttpChannel(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransport transport, HttpInput<T> input)
public static HttpChannel<?> getCurrentHttpChannel()
protected static void setCurrentHttpChannel(HttpChannel<?> channel)
public HttpChannelState getState()
public HttpVersion getHttpVersion()
public int getRequests()
public Connector getConnector()
public ByteBufferPool getByteBufferPool()
public HttpConfiguration getHttpConfiguration()
public Server getServer()
public Request getRequest()
public Response getResponse()
public EndPoint getEndPoint()
public InetSocketAddress getLocalAddress()
public InetSocketAddress getRemoteAddress()
public int getHeaderCacheSize()
getHeaderCacheSize in interface HttpParser.HttpHandler<T>public void continue100(int available)
throws IOException
IOException - if the InputStream cannot be createdpublic void reset()
protected void handleException(Throwable x)
Sends an error 500, performing a special logic to detect whether the request is suspended, to avoid concurrent writes from the application.
It may happen that the application suspends, and then throws an exception, while an application
spawned thread writes the response content; in such case, we attempt to commit the error directly
bypassing the ErrorHandler mechanisms and the response OutputStream.
x - the Throwable that caused the problempublic boolean isExpecting100Continue()
public boolean isExpecting102Processing()
public boolean startRequest(HttpMethod httpMethod, String method, ByteBuffer uri, HttpVersion version)
startRequest in interface HttpParser.RequestHandler<T>public boolean parsedHeader(HttpField field)
parsedHeader in interface HttpParser.HttpHandler<T>public boolean parsedHostHeader(String host, int port)
parsedHostHeader in interface HttpParser.RequestHandler<T>public boolean headerComplete()
headerComplete in interface HttpParser.HttpHandler<T>public boolean content(T item)
content in interface HttpParser.HttpHandler<T>public boolean messageComplete()
messageComplete in interface HttpParser.HttpHandler<T>public boolean earlyEOF()
earlyEOF in interface HttpParser.HttpHandler<T>public void badMessage(int status,
String reason)
badMessage in interface HttpParser.HttpHandler<T>protected boolean commitResponse(HttpGenerator.ResponseInfo info, ByteBuffer content, boolean complete) throws IOException
IOExceptionprotected boolean isCommitted()
protected void write(ByteBuffer content, boolean complete) throws IOException
Requests to write (in a blocking way) the given response content buffer, committing the response if needed.
content - the content buffer to writecomplete - whether the content is complete for the responseIOException - if the write failsprotected void execute(Runnable task)
public Scheduler getScheduler()
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.