|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Represents an established server-side connection. For example, a
TCP-based ServerConnection implementation typically
contains a Socket.
ServerConnection is implemented by a
connection-based ServerEndpoint implementation that uses
ServerConnectionManager for managing connections. A
ServerConnection is created by the implementation for
newly-accepted connections and passed to the manager's handleConnection method.
| Method Summary | |
InvocationConstraints |
checkConstraints(InboundRequestHandle handle,
InvocationConstraints constraints)
Implements InboundRequest.checkConstraints for a request with the
specified handle. |
void |
checkPermissions(InboundRequestHandle handle)
Implements InboundRequest.checkPermissions for a request with the
specified handle. |
void |
close()
Closes this connection. |
SocketChannel |
getChannel()
Returns a socket channel that performs I/O on this connection, or null if no socket channel is available. |
InputStream |
getInputStream()
Returns an input stream that reads data from this connection. |
OutputStream |
getOutputStream()
Returns an output stream that writes data to this connection. |
void |
populateContext(InboundRequestHandle handle,
Collection context)
Populates the supplied collection with context information representing a request with the specified handle. |
InboundRequestHandle |
processRequestData(InputStream in,
OutputStream out)
Reads from the specified input stream any per-request data required by this connection for an inbound request, writes any required response data to the specified output stream, and returns a handle for the request. |
| Method Detail |
public InputStream getInputStream()
throws IOException
IOException - if an I/O exception occurs
public OutputStream getOutputStream()
throws IOException
IOException - if an I/O exception occurspublic SocketChannel getChannel()
null if no socket channel is available. If a
non-null socket channel is returned, it is
connected.
null
public InboundRequestHandle processRequestData(InputStream in,
OutputStream out)
throws IOException
This method is invoked by
ServerConnectionManager with the request input
stream and the response output stream of the InboundRequest that it creates for the request when the
request is first received. This method reads information that
was sent by Connection.writeRequestData and writes information to be read
by Connection.readResponseData. This method can be used, for
example, to process per-request information about delegation,
client authentication, or client privileges.
If, for security reasons, this method determines that the
request must not be processed further (for example, because
client authentication failed), this method should close the
response output stream and throw a
SecurityException after writing any response data.
There may be multiple requests in progress concurrently over this connection, and data read from and written to the specified streams may be buffered and multiplexed with data from other requests on this connection's underlying streams. Therefore, this method should only read data from the request input stream and write data to the response output stream and must not otherwise read from or write to this connection's underlying streams.
in - the request input stream of the requestout - the response output stream of the request
NullPointerException - if in or
out is null
IOException - if an I/O exception occurs
SecurityException - if a security exception occurspublic void checkPermissions(InboundRequestHandle handle)
InboundRequest.checkPermissions for a request with the
specified handle.
handle - the handle for the request
SecurityException - if the current security context does
not have the permissions necessary to receive the request
IllegalArgumentException - if the specified handle was
not returned from this connection's
processRequestData method
NullPointerException - if handle is
null
public InvocationConstraints checkConstraints(InboundRequestHandle handle,
InvocationConstraints constraints)
throws UnsupportedConstraintException
InboundRequest.checkConstraints for a request with the
specified handle.
handle - the handle for the requestconstraints - the constraints that must be satisfied
UnsupportedConstraintException - if the transport layer
aspects of any of the specified requirements are not satisfied
by this request
IllegalArgumentException - if the specified handle was
not returned from this connection's
processRequestData method
NullPointerException - if handle or
constraints is null
public void populateContext(InboundRequestHandle handle,
Collection context)
InboundRequest.populateContext for such requests; the context
may also be populated by the connection manager.
handle - the handle for the requestcontext - the context collection to populate
IllegalArgumentException - if the specified handle was
not returned from this connection's
processRequestData method
NullPointerException - if handle or
context is null
UnsupportedOperationException - if context
is unmodifiable
public void close()
throws IOException
IOException - if an I/O exception occurs
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||