public class ServerConnection extends Connection<Server>
Constructor and Description |
---|
ServerConnection(BaseHelper<Server> helper,
java.net.Socket socket,
java.nio.channels.SocketChannel socketChannel)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addResponseHeaders(Response response,
Series<Parameter> headers)
Adds the response headers.
|
boolean |
canRead()
Indicates if the connection's socket can be read for inbound data.
|
void |
commit(Response response)
Asks the server connector to immediately commit the given response
associated to this request, making it ready to be sent back to the
client.
|
protected ConnectedRequest |
createRequest(Context context,
ServerConnection connection,
java.lang.String methodName,
java.lang.String resourceUri,
java.lang.String version,
Series<Parameter> headers,
Representation entity,
boolean confidential,
java.security.Principal userPrincipal)
Creates a new request.
|
protected void |
readMessage()
Reads the next request sent by the client if available.
|
protected void |
writeMessage(Response response)
Write the given response on the socket.
|
protected void |
writeMessageHeadLine(Response response,
java.io.OutputStream headStream)
Writes the message head line to the given output stream.
|
addEntityHeaders, addGeneralHeaders, canWrite, 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 ServerConnection(BaseHelper<Server> 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 addResponseHeaders(Response response, Series<Parameter> headers)
response
- The response to inspect.headers
- The headers series to update.public boolean canRead()
Connection
canRead
in class Connection<Server>
public void commit(Response response)
response
- The response to commit.protected ConnectedRequest createRequest(Context context, ServerConnection connection, java.lang.String methodName, java.lang.String resourceUri, java.lang.String version, Series<Parameter> headers, Representation entity, boolean confidential, java.security.Principal userPrincipal)
context
- The current context.connection
- The associated connection.methodName
- The method name.resourceUri
- The target resource URI.version
- The protocol version.headers
- The request headers.entity
- The request entity.confidential
- True if received confidentially.userPrincipal
- The user principal.protected void readMessage() throws java.io.IOException
readMessage
in class Connection<Server>
java.io.IOException
protected void writeMessage(Response response)
writeMessage
in class Connection<Server>
response
- The response to write.protected void writeMessageHeadLine(Response response, java.io.OutputStream headStream) throws java.io.IOException
Connection
writeMessageHeadLine
in class Connection<Server>
response
- The source message.headStream
- The target stream.java.io.IOException
Copyright © 2005-2012. All Rights Reserved.