public class HttpClientConnectionHandler extends Object implements TcpServer.ConnectionHandler, de.unkrig.commons.lang.protocol.Stoppable
Servlett
s that handle requests that are received from a client connection.Constructor and Description |
---|
HttpClientConnectionHandler() |
HttpClientConnectionHandler(Iterable<Servlett> servletts) |
HttpClientConnectionHandler(Iterable<Servlett> servletts,
String readRequestLogginPrefix,
String writeResponseLoggingPrefix) |
HttpClientConnectionHandler(Servlett servlett) |
HttpClientConnectionHandler(Servlett servlett,
String readRequestLogginPrefix,
String writeResponseLoggingPrefix) |
HttpClientConnectionHandler(String readRequestLogginPrefix,
String writeResponseLoggingPrefix) |
Modifier and Type | Method and Description |
---|---|
Iterable<Servlett> |
getServletts() |
void |
handleConnection(InputStream in,
OutputStream out,
InetSocketAddress localSocketAddress,
InetSocketAddress remoteSocketAddress,
de.unkrig.commons.lang.protocol.Stoppable stoppable)
This one is called from the
TcpServer . |
void |
handleConnection(ReadableByteChannel in,
WritableByteChannel out,
InetSocketAddress localSocketAddress,
InetSocketAddress remoteSocketAddress,
Multiplexer multiplexer,
de.unkrig.commons.lang.protocol.Stoppable stoppable)
This one is called from the
NioHttpServer . |
protected void |
processRequests(InputStream in,
OutputStream out,
de.unkrig.commons.lang.protocol.Stoppable stoppable)
Processes HTTP requests from the client until the connection breaks.
|
void |
setServlett(Servlett servlett)
Clears the set of currently registerd
Servlett s and registers the given servlett. |
void |
setServletts(Iterable<Servlett> servletts)
Clears the set of currently registerd
Servlett s and registers the given servletts. |
void |
stop() |
public HttpClientConnectionHandler()
public HttpClientConnectionHandler(String readRequestLogginPrefix, String writeResponseLoggingPrefix)
readRequestLogginPrefix
- E.g. ">>> "
writeResponseLoggingPrefix
- E.g. "<<< "
public HttpClientConnectionHandler(Servlett servlett)
servlett
- See setServlett(Servlett)
public HttpClientConnectionHandler(Servlett servlett, String readRequestLogginPrefix, String writeResponseLoggingPrefix)
servlett
- See setServlett(Servlett)
readRequestLogginPrefix
- E.g. ">>> "
writeResponseLoggingPrefix
- E.g. "<<< "
public HttpClientConnectionHandler(Iterable<Servlett> servletts)
servletts
- See setServletts(Iterable)
public HttpClientConnectionHandler(Iterable<Servlett> servletts, String readRequestLogginPrefix, String writeResponseLoggingPrefix)
servletts
- See setServletts(Iterable)
readRequestLogginPrefix
- E.g. ">>> "
writeResponseLoggingPrefix
- E.g. "<<< "
public Iterable<Servlett> getServletts()
Servlett
s currently registered with this HttpClientConnectionHandler
public void setServlett(Servlett servlett)
Servlett
s and registers the given servlett.public void setServletts(Iterable<Servlett> servletts)
Servlett
s and registers the given servletts.public void handleConnection(InputStream in, OutputStream out, InetSocketAddress localSocketAddress, InetSocketAddress remoteSocketAddress, de.unkrig.commons.lang.protocol.Stoppable stoppable) throws IOException, InvalidHttpMessageException
TcpServer
. Override if you want to process the connection before
request processing begins.handleConnection
in interface TcpServer.ConnectionHandler
localSocketAddress
- Could be examined by implementations that override this methodremoteSocketAddress
- Could be examined by implementations that override this methodstoppable
- Stopping this will break the connectionIOException
InvalidHttpMessageException
public void handleConnection(ReadableByteChannel in, WritableByteChannel out, InetSocketAddress localSocketAddress, InetSocketAddress remoteSocketAddress, Multiplexer multiplexer, de.unkrig.commons.lang.protocol.Stoppable stoppable) throws IOException
NioHttpServer
. Override if you want to process the connection before
request processing begins.localSocketAddress
- Could be examined by implementations that override this methodremoteSocketAddress
- Could be examined by implementations that override this methodstoppable
- Stopping this will break the connectionIOException
protected void processRequests(InputStream in, OutputStream out, de.unkrig.commons.lang.protocol.Stoppable stoppable) throws IOException, InvalidHttpMessageException
stoppable
- Stopping this will break the connectionIOException
InvalidHttpMessageException
public void stop()
stop
in interface de.unkrig.commons.lang.protocol.Stoppable
Copyright © 2018 Arno Unkrig. All rights reserved.