private class HttpServerEndpoint.LE extends Object implements ServerEndpoint.ListenEndpoint
Modifier and Type | Class and Description |
---|---|
private class |
HttpServerEndpoint.LE.Cookie
ListenCookie implementation: identifies a listen operation
by containing the local port that the server socket is
bound to.
|
Constructor and Description |
---|
HttpServerEndpoint.LE() |
Modifier and Type | Method and Description |
---|---|
void |
checkPermissions()
Verifies that the current security context has all of the
security permissions necessary to listen for requests on
this
ListenEndpoint . |
boolean |
equals(Object obj) |
private int |
getPort() |
private ServerSocketFactory |
getSSF() |
int |
hashCode() |
ServerEndpoint.ListenHandle |
listen(RequestDispatcher requestDispatcher)
Listens for requests received on the communication endpoint
represented by this
ListenEndpoint ,
dispatching them to the supplied
RequestDispatcher in the form of InboundRequest instances. |
String |
toString() |
public void checkPermissions()
ServerEndpoint.ListenEndpoint
ListenEndpoint
.
This method should be used when an invocation of
ListenEndpoint.listen
is used to receive
requests for a variety of interested parties, each with
potentially different security permissions possibly more
limited than those granted to the code managing the shared
endpoint, so that the managing code can enforce proper
access control for each party.
checkPermissions
in interface ServerEndpoint.ListenEndpoint
InboundRequest.checkPermissions()
public ServerEndpoint.ListenHandle listen(RequestDispatcher requestDispatcher) throws IOException
ServerEndpoint.ListenEndpoint
ListenEndpoint
,
dispatching them to the supplied
RequestDispatcher
in the form of InboundRequest
instances.
This method starts a continuing listen operation
and then immediately returns a ListenHandle
that represents the listen operation that was started. For
the duration of the listen operation, all requests received
on the communication endpoint will be dispatched to the
supplied RequestDispatcher
as
InboundRequest
instances. The returned
ListenHandle
can be used to stop the listen
operation and to obtain a ListenCookie
to identify the
listen operation as the return value of the ListenContext.addListenEndpoint
method.
Typically, this method is invoked by a
ListenContext
implementation when its
addListenEndpoint
method is called as part of
the execution of a
ServerEndpoint.enumerateListenEndpoints
invocation. The Endpoint
instance that can be
used to send requests to the communication endpoints
represented by the ServerEndpoint
(including
this ListenEndpoint
) is produced by the
ServerEndpoint
implementation given, in part,
the ListenCookie
obtained from the
ListenHandle
returned by this method.
This method verifies that the current security context
has all of the security permissions necessary to listen for
requests on this ListenEndpoint
, as
appropriate to the implementation of this interface (see
ServerEndpoint.ListenEndpoint.checkPermissions()
). Note that in addition to this
security check, the implementation of this interface may
also perform a further security check per request received
(when the origin of a given request is known), to verify
that the same security context also has all of the
permissions necessary to receive requests from that
particular origin (see InboundRequest.checkPermissions()
). This interface does not
provide an API for determining when such a security check
has failed; the behavior will be as if the associated
request never occurred.
Implementations of this method should provide robust
behavior (such as continuing to listen for requests) in the
event that the supplied RequestDispatcher
's
dispatch
method throws an unchecked exception.
Requests may be dispatched in separate threads as
necessary for requests received on this
ListenEndpoint
while others are still being
processed by earlier dispatch
invocations.
The implementation of this interface must assume that there
may be arbitrary execution dependencies between the
processing of such concurrently received requests, and thus
it must not attempt any particular serialization of their
processing; therefore, a request received must be either
dispatched or rejected within a reasonable period of time,
rather than be queued indefinitely waiting for the return
of earlier dispatch
invocations.
Implementations of this method should generally dispatch a request in a daemon thread with a security context at least as restrictive as the one in which this method was invoked, and without holding visible synchronization locks.
listen
in interface ServerEndpoint.ListenEndpoint
requestDispatcher
- the RequestDispatcher
to use to dispatch incoming requests received on this
communication endpointListenHandle
that represents the
listen operation that was startedIOException
- if an I/O exception occurs while
attempting to listen for requests on this
ListenEndpoint
. This could occur, for
example, if an I/O resource associated with this
communication endpoint is already in exclusive use, or if
there are insufficient I/O resources for the operation.private int getPort()
private ServerSocketFactory getSSF()
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.