Class HttpsExchange
java.lang.Object
com.sun.net.httpserver.HttpExchange
com.sun.net.httpserver.HttpsExchange
- All Implemented Interfaces:
Request, AutoCloseable
This class encapsulates a HTTPS request received and a response to be
generated in one exchange and defines the extensions to
HttpExchange
that are specific to the HTTPS protocol.- Since:
- 1.6
-
Constructor Summary
Constructors -
Method Summary
Methods declared in class HttpExchange
close, getAttribute, getHttpContext, getLocalAddress, getPrincipal, getProtocol, getRemoteAddress, getRequestBody, getRequestHeaders, getRequestMethod, getRequestURI, getResponseBody, getResponseCode, getResponseHeaders, sendResponseHeaders, setAttribute, setStreams
Modifier and TypeMethodDescriptionabstract void
close()
Ends this exchange by doing the following in sequence: close the requestInputStream
, if not already closed.abstract Object
getAttribute
(String name) Filter
modules may store arbitrary objects withHttpExchange
instances as an out-of-band communication mechanism.abstract HttpContext
Returns theHttpContext
for this exchange.abstract InetSocketAddress
Returns the local address on which the request was received.abstract HttpPrincipal
If an authenticator is set on theHttpContext
that owns this exchange, then this method will return theHttpPrincipal
that represents the authenticated user for thisHttpExchange
.abstract String
Returns the protocol string from the request in the form protocol/majorVersion.minorVersion.abstract InetSocketAddress
Returns the address of the remote entity invoking this request.abstract InputStream
Returns a stream from which the request body can be read.abstract Headers
Returns an immutableHeaders
containing the HTTP headers that were included with this request.abstract String
Returns the request method.abstract URI
Returns the requestURI
.abstract OutputStream
Returns a stream to which the response body must be written.abstract int
Returns the response code, if it has already been set.abstract Headers
Returns a mutableHeaders
into which the HTTP response headers can be stored and which will be transmitted as part of this response.abstract void
sendResponseHeaders
(int rCode, long responseLength) Starts sending the response back to the client using the current set of response headers and the numeric response code as specified in this method.abstract void
setAttribute
(String name, Object value) Filter
modules may store arbitrary objects withHttpExchange
instances as an out-of-band communication mechanism.abstract void
Used by Filters to wrap either (or both) of this exchange'sInputStream
andOutputStream
, with the given filtered streams so that subsequent calls toHttpExchange.getRequestBody()
will return the givenInputStream
, and calls toHttpExchange.getResponseBody()
will return the givenOutputStream
.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
HttpsExchange
protected HttpsExchange()Constructor for subclasses to call.
-
-
Method Details
-
getSSLSession
Get theSSLSession
for this exchange.- Returns:
- the
SSLSession
-