# 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

Constructors
Modifier
Constructor
Description
`protected`
`HttpsExchange()`
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(String name)`
`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(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 with `HttpExchange` instances as an out-of-band communication mechanism.
`abstract void`
`setStreams(InputStream i, OutputStream o)`
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(Object obj)`
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(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.

### Methods declared in interface Request

`with`
Modifier and Type
Method
Description
`default Request`
`with(String headerName, List<String> headerValues)`
Returns an identical `Request` with an additional header.

## 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`