|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.engine.http.connector.Connection<Server>
org.restlet.engine.http.connector.ServerConnection
public class ServerConnection
Generic HTTP-like server connection.
Constructor Summary | |
---|---|
ServerConnection(BaseHelper<Server> helper,
Socket socket,
SocketChannel socketChannel)
Constructor. |
Method Summary | |
---|---|
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,
String methodName,
String resourceUri,
String version,
Series<Parameter> headers,
Representation entity,
boolean confidential,
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,
OutputStream headStream)
Writes the message head line to the given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServerConnection(BaseHelper<Server> helper, Socket socket, SocketChannel socketChannel) throws IOException
helper
- The parent connector helper.socket
- The underlying BIO socket.socketChannel
- The underlying NIO socket channel.
IOException
Method Detail |
---|
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, String methodName, String resourceUri, String version, Series<Parameter> headers, Representation entity, boolean confidential, 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 IOException
readMessage
in class Connection<Server>
IOException
protected void writeMessage(Response response)
writeMessage
in class Connection<Server>
response
- The response to write.protected void writeMessageHeadLine(Response response, OutputStream headStream) throws IOException
Connection
writeMessageHeadLine
in class Connection<Server>
response
- The source message.headStream
- The target stream.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |