public class ClientConnection extends Connection<Client>
Constructor and Description |
---|
ClientConnection(BaseHelper<Client> helper,
java.net.Socket socket,
java.nio.channels.SocketChannel socketChannel)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addRequestHeaders(Request request,
Series<Parameter> headers)
Adds the request headers.
|
boolean |
canEnqueue()
Indicates whether the client connection can accept a new message.
|
boolean |
canRead()
Indicates if the connection's socket can be read for inbound data.
|
boolean |
canWrite()
Indicates if the connection's socket can be written for outbound data.
|
protected void |
copyResponseTransportHeaders(Series<Parameter> headers,
Response response)
Copies headers into a response.
|
protected Status |
createStatus(int code)
Returns the status corresponding to a given status code.
|
protected void |
readMessage()
Reads the next message received via the inbound stream or channel.
|
protected void |
writeMessage(Response response)
Write the given response on the socket.
|
protected void |
writeMessageHeadLine(Response message,
java.io.OutputStream headStream)
Writes the message head line to the given output stream.
|
addEntityHeaders, addGeneralHeaders, close, createInboundEntity, getAddress, getHelper, getInboundEntityChannel, getInboundEntityStream, getInboundMessages, getInboundStream, getLogger, getOutboundEntityChannel, getOutboundEntityStream, getOutboundMessages, getOutboundStream, getPort, getRepresentation, getRepresentation, getSocket, getSocketChannel, getSslCipherSuite, getSslClientCertificates, getSslKeySize, getState, isBusy, isClientSide, isInboundBusy, isOutboundBusy, isPersistent, isPipelining, isServerSide, onEndReached, onError, open, readMessages, setInboundBusy, setOutboundBusy, setPersistent, setPipelining, setState, shouldBeChunked, writeMessage, writeMessageBody, writeMessageHead, writeMessageHead, writeMessages
public ClientConnection(BaseHelper<Client> helper, java.net.Socket socket, java.nio.channels.SocketChannel socketChannel) throws java.io.IOException
helper
- The parent connector helper.socket
- The underlying BIO socket.socketChannel
- The underlying NIO socket channel.java.io.IOException
protected void addRequestHeaders(Request request, Series<Parameter> headers)
request
- The request to inspect.headers
- The headers series to update.public boolean canEnqueue()
public boolean canRead()
Connection
canRead
in class Connection<Client>
public boolean canWrite()
Connection
canWrite
in class Connection<Client>
protected void copyResponseTransportHeaders(Series<Parameter> headers, Response response)
headers
- The headers to copy.response
- The response to update.protected Status createStatus(int code)
code
- The status code.protected void readMessage() throws java.io.IOException
Connection
readMessage
in class Connection<Client>
java.io.IOException
protected void writeMessage(Response response)
writeMessage
in class Connection<Client>
response
- The response to write.protected void writeMessageHeadLine(Response message, java.io.OutputStream headStream) throws java.io.IOException
Connection
writeMessageHeadLine
in class Connection<Client>
message
- The source message.headStream
- The target stream.java.io.IOException
Copyright © 2005-2012. All Rights Reserved.