Class HttpsExchange
java.lang.Object
com.sun.net.httpserver.HttpExchange
com.sun.net.httpserver.HttpsExchange
- All Implemented Interfaces:
Request, AutoCloseable
public abstract class HttpsExchange extends HttpExchange
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
Field Summary
Fields declared in class HttpExchange
RSPBODY_CHUNKED, RSPBODY_EMPTY | Modifier and Type | Field | Description |
|---|---|---|
static final long |
RSPBODY_CHUNKED |
The response body length is unspecified and will be chunk encoded |
static final long |
RSPBODY_EMPTY |
No response body is being sent with this response |
Constructor Summary
| Modifier | Constructor | Description |
|---|---|---|
protected |
Constructor for subclasses to call. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
abstract SSLSession |
getSSLSession() |
Get the SSLSession for this exchange. |
Methods declared in class HttpExchange
close, getAttribute, getHttpContext, getLocalAddress, getPrincipal, getProtocol, getRemoteAddress, getRequestBody, getRequestHeaders, getRequestMethod, getRequestURI, getResponseBody, getResponseCode, getResponseHeaders, sendResponseHeaders, setAttribute, setStreams | Modifier and Type | Method | Description |
|---|---|---|
abstract void |
close() |
Ends this exchange by doing the following in sequence: close the request InputStream, if not already closed. |
abstract Object |
getAttribute |
Filter modules may store arbitrary objects with HttpExchange instances as an out-of-band communication mechanism. |
abstract HttpContext |
getHttpContext() |
Returns the HttpContext for this exchange. |
abstract InetSocketAddress |
getLocalAddress() |
Returns the local address on which the request was received. |
abstract HttpPrincipal |
getPrincipal() |
If an authenticator is set on the HttpContext that owns this exchange, then this method will return the HttpPrincipal that represents the authenticated user for this HttpExchange. |
abstract String |
getProtocol() |
Returns the protocol string from the request in the form protocol/majorVersion.minorVersion. |
abstract InetSocketAddress |
getRemoteAddress() |
Returns the address of the remote entity invoking this request. |
abstract InputStream |
getRequestBody() |
Returns a stream from which the request body can be read. |
abstract Headers |
getRequestHeaders() |
Returns an immutable Headers containing the HTTP headers that were included with this request. |
abstract String |
getRequestMethod() |
Returns the request method. |
abstract URI |
getRequestURI() |
Returns the request URI. |
abstract OutputStream |
getResponseBody() |
Returns a stream to which the response body must be written. |
abstract int |
getResponseCode() |
Returns the response code, if it has already been set. |
abstract Headers |
getResponseHeaders() |
Returns a mutable Headers into which the HTTP response headers can be stored and which will be transmitted as part of this response. |
abstract void |
sendResponseHeaders |
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 |
Filter modules may store arbitrary objects with HttpExchange instances as an out-of-band communication mechanism. |
abstract void |
setStreams |
Used by Filters to wrap either (or both) of this exchange's InputStream and OutputStream, with the given filtered streams so that subsequent calls to HttpExchange.getRequestBody() will return the given InputStream, and calls to HttpExchange.getResponseBody() will return the given OutputStream. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
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 this Object. |
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 |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
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 |
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 |
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
public abstract SSLSession getSSLSession()
Get the
SSLSession for this exchange.- Returns:
- the
SSLSession
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.