|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.jini.jeri.http.HttpEndpoint
An implementation of the Endpoint abstraction that uses HTTP
messages sent over TCP sockets (instances of Socket) for the
underlying communication mechanism.
HttpEndpoint instances contain a host name and a
TCP port number, as well as an optional SocketFactory for
customizing the type of Socket to use. The host name
and port number are used as the remote address to connect to when
making socket connections. Note that constructing an
HttpEndpoint with a SocketFactory
instance that produces SSL sockets does not result in an endpoint
that is fully HTTPS capable.
HttpEndpoint instances map outgoing requests to HTTP
request/response messages; when possible, underlying TCP connections are
reused for multiple non-overlapping outgoing requests. Outbound request
data is sent as the entity-body of an HTTP POST request;
inbound response data is received as the entity-body of the
corresponding HTTP response message. For information on HTTP, refer to RFC 2616.
HttpEndpoint can be configured via system properties to send
HTTP messages through an intermediary HTTP proxy server. It also supports
basic and digest HTTP authentication, specified in RFC 2617. The mechanisms
involved in configuring each of these features are the same as those used by
HttpURLConnection; for details, see the
net.jini.jeri.http package documentation.
A SocketFactory used with an
HttpEndpoint should be serializable and must implement
Object.equals to obey the guidelines that are
specified for equals methods of Endpoint
instances.
HttpServerEndpoint,
Serialized Form| Method Summary | |
boolean |
checkTrustEquivalence(Object obj)
Returns true if the specified object (which is not
yet known to be trusted) is equivalent in trust, content, and
function to this known trusted object, and false
otherwise.
|
boolean |
equals(Object obj)
Compares the specified object with this HttpEndpoint for equality.
|
String |
getHost()
Returns the host that this HttpEndpoint connects to. |
static HttpEndpoint |
getInstance(String host,
int port)
Returns an HttpEndpoint instance for the given host name
and TCP port number. |
static HttpEndpoint |
getInstance(String host,
int port,
SocketFactory sf)
Returns an HttpEndpoint instance for the given
host name and TCP port number that contains the given SocketFactory. |
int |
getPort()
Returns the TCP port that this HttpEndpoint connects to. |
SocketFactory |
getSocketFactory()
Returns the SocketFactory that this endpoint uses to
create Socket objects. |
int |
hashCode()
Returns the hash code value for this HttpEndpoint. |
OutboundRequestIterator |
newRequest(InvocationConstraints constraints)
Returns an OutboundRequestIterator to use to send
a new request to this remote endpoint using the specified
constraints.
The constraints must be the complete, absolute constraints
for the request.
The returned |
String |
toString()
Returns a string representation of this HttpEndpoint. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
public static HttpEndpoint getInstance(String host,
int port)
HttpEndpoint instance for the given host name
and TCP port number. Note that if HTTP proxying is in effect, then an
explicit host name or IP address (i.e., not "localhost") must be
provided, or else the returned HttpEndpoint will be unable
to properly send requests through the proxy.
The SocketFactory contained in the returned
HttpEndpoint will be null, indicating
that this endpoint will create Socket objects directly.
host - the host for the endpoint to connect toport - the TCP port on the given host for the endpoint to
connect to
HttpEndpoint instance
IllegalArgumentException - if the port number is out of
the range 1 to 65535 (inclusive)
NullPointerException - if host is
null
public static HttpEndpoint getInstance(String host,
int port,
SocketFactory sf)
HttpEndpoint instance for the given
host name and TCP port number that contains the given SocketFactory. Note that if HTTP proxying is in effect, then
an explicit host name or IP address (i.e., not "localhost")
must be provided, or else the returned
HttpEndpoint will be unable to properly send
requests through the proxy.
If the socket factory argument is null, then
this endpoint will create Socket objects directly.
host - the host for the endpoint to connect toport - the TCP port on the given host for the endpoint to
connect tosf - the SocketFactory to use for this
HttpEndpoint, or null
HttpEndpoint instance
IllegalArgumentException - if the port number is out of
the range 1 to 65535 (inclusive)
NullPointerException - if host is
nullpublic String getHost()
HttpEndpoint connects to.
public int getPort()
HttpEndpoint connects to.
public SocketFactory getSocketFactory()
SocketFactory that this endpoint uses to
create Socket objects.
null if this endpoint creates sockets
directlypublic OutboundRequestIterator newRequest(InvocationConstraints constraints)
OutboundRequestIterator to use to send
a new request to this remote endpoint using the specified
constraints.
The constraints must be the complete, absolute constraints for the request.
The returned OutboundRequestIterator's next method behaves as follows:
Initiates an attempt to communicate the request to this remote endpoint.When the implementation of this method needs to create a new
Socket, it will do so by invoking one of thecreateSocketmethods on theSocketFactoryof theHttpEndpointthat produced this iterator if non-null, or it will create aSocketdirectly otherwise.If there is a security manager, its
checkConnectmethod will be invoked with the remote IP address and port of theSocketto be used for the communication; this could result in aSecurityException.Throws
NoSuchElementExceptionif this iterator does not support making another attempt to communicate the request (that is, ifhasNextwould returnfalse).Throws
ConnectExceptionif a failure occurs while connecting a socket to the remote host and port, such as if the connection was refused (no entity is listening on that port or the host is too busy).Throws
IOExceptionif an I/O exception occurs while performing this operation.Throws
SecurityExceptionif there is a security manager and the invocation of itscheckConnectmethod fails.
newRequest in interface Endpointconstraints - the complete, absolute constraints
OutboundRequestIterator to use to send
a new request to this remote endpoint
NullPointerException - if constraints is
nullpublic int hashCode()
HttpEndpoint.
HttpEndpointpublic boolean equals(Object obj)
HttpEndpoint for equality.
This method returns true if and only if
HttpEndpoint,
SocketFactory or the SocketFactory in
the specified object has the same class and is equal to the one
in this object.
obj - the object to compare with
true if obj is equivalent to
this object; false otherwisepublic boolean checkTrustEquivalence(Object obj)
true if the specified object (which is not
yet known to be trusted) is equivalent in trust, content, and
function to this known trusted object, and false
otherwise.
This method returns true if and only if
HttpEndpoint,
SocketFactory or the SocketFactory in
the specified object has the same class and is equal to the one
in this object.
checkTrustEquivalence in interface TrustEquivalenceobj - object to check that is not yet known to be trusted
true if the specified object (that is not yet
known to be trusted) is equivalent in trust, content, and function to
this known trusted object, and returns false otherwisepublic String toString()
HttpEndpoint.
HttpEndpoint
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||