APIdia Launch Partner
Top Fields Constructors Methods
jdk.internal.net.http

pack-priv final Class ImmutableHttpRequest

extends HttpRequest
Class Inheritance
Imports
java.net.URI, java.net.http.HttpHeaders, .HttpRequest, .HttpOption, .HttpClient.Version, java.time.Duration, java.util.Map, .Objects, .Optional

Field Summary

Modifier and TypeField and Description
private final boolean
private final HttpHeaders
private final String
private final Map<HttpOption<?>, Object>
private final Optional<HttpRequest.BodyPublisher>
private final Optional<Duration>
private final URI
private final Optional<HttpClient.Version>

Constructor Summary

AccessConstructor and Description
pack-priv
ImmutableHttpRequest(HttpRequestBuilderImpl builder)

Creates an ImmutableHttpRequest from the given builder.

Method Summary

Modifier and TypeMethod and Description
public Optional<HttpRequest.BodyPublisher>
bodyPublisher()

Implements abstract java.net.http.HttpRequest.bodyPublisher.

Returns an Optional containing the BodyPublisher set on this request.

public boolean
expectContinue()

Implements abstract java.net.http.HttpRequest.expectContinue.

Returns this request's expect continue setting.

public <T> Optional<T>
getOption(HttpOption<T> option)

Overrides java.net.http.HttpRequest.getOption.

Returns the value configured on this request for the given option, if any.

public HttpHeaders
headers()

Implements abstract java.net.http.HttpRequest.headers.

The (user-accessible) request headers that this request was (or will be) sent with.

public String
method()

Implements abstract java.net.http.HttpRequest.method.

Returns the request method for this request.

public Map<HttpOption<?>, Object>
public Optional<Duration>
timeout()

Implements abstract java.net.http.HttpRequest.timeout.

Returns an Optional containing this request's timeout duration.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public URI
uri()

Implements abstract java.net.http.HttpRequest.uri.

Returns this request's URI.

public Optional<HttpClient.Version>
version()

Implements abstract java.net.http.HttpRequest.version.

Returns an Optional containing the HTTP protocol version that will be requested for this HttpRequest.

Inherited from java.net.http.HttpRequest:
equalshashCodenewBuildernewBuildernewBuilder

Field Detail

expectContinueback to summary
private final boolean expectContinue
headersback to summary
private final HttpHeaders headers
methodback to summary
private final String method
optionsback to summary
private final Map<HttpOption<?>, Object> options
requestPublisherback to summary
private final Optional<HttpRequest.BodyPublisher> requestPublisher
timeoutback to summary
private final Optional<Duration> timeout
uriback to summary
private final URI uri
versionback to summary
private final Optional<HttpClient.Version> version

Constructor Detail

ImmutableHttpRequestback to summary
pack-priv ImmutableHttpRequest(HttpRequestBuilderImpl builder)

Creates an ImmutableHttpRequest from the given builder.

Method Detail

bodyPublisherback to summary
public Optional<HttpRequest.BodyPublisher> bodyPublisher()

Implements abstract java.net.http.HttpRequest.bodyPublisher.

Doc from java.net.http.HttpRequest.bodyPublisher.

Returns an Optional containing the BodyPublisher set on this request. If no BodyPublisher was set in the requests's builder, then the Optional is empty.

Annotations
@Override
expectContinueback to summary
public boolean expectContinue()

Implements abstract java.net.http.HttpRequest.expectContinue.

Doc from java.net.http.HttpRequest.expectContinue.

Returns this request's expect continue setting.

Annotations
@Override
getOptionback to summary
public <T> Optional<T> getOption(HttpOption<T> option)

Overrides java.net.http.HttpRequest.getOption.

Doc from java.net.http.HttpRequest.getOption.

Returns the value configured on this request for the given option, if any.

Annotations
@Override
headersback to summary
public HttpHeaders headers()

Implements abstract java.net.http.HttpRequest.headers.

Doc from java.net.http.HttpRequest.headers.

The (user-accessible) request headers that this request was (or will be) sent with.

Annotations
@Override
methodback to summary
public String method()

Implements abstract java.net.http.HttpRequest.method.

Doc from java.net.http.HttpRequest.method.

Returns the request method for this request. If not set explicitly, the default method for any request is "GET".

Annotations
@Override
optionsback to summary
public Map<HttpOption<?>, Object> options()
timeoutback to summary
public Optional<Duration> timeout()

Implements abstract java.net.http.HttpRequest.timeout.

Doc from java.net.http.HttpRequest.timeout.

Returns an Optional containing this request's timeout duration. If the timeout duration was not set in the request's builder, then the Optional is empty.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
uriback to summary
public URI uri()

Implements abstract java.net.http.HttpRequest.uri.

Doc from java.net.http.HttpRequest.uri.

Returns this request's URI.

Annotations
@Override
versionback to summary
public Optional<HttpClient.Version> version()

Implements abstract java.net.http.HttpRequest.version.

Doc from java.net.http.HttpRequest.version.

Returns an Optional containing the HTTP protocol version that will be requested for this HttpRequest. If the version was not set in the request's builder, then the Optional is empty. In that case, the version requested will be that of the sending HttpClient. The corresponding HttpResponse should be queried to determine the version that was actually used.

Annotations
@Override