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

public Class HttpRequestBuilderImpl

extends Object
implements Builder
Class Inheritance
All Implemented Interfaces
java.net.http.HttpRequest.Builder
Imports
java.net.URI, java.net.http.HttpRequest.Builder, .HttpOption, .HttpClient, .HttpRequest, .HttpRequest.BodyPublisher, java.time.Duration, java.util.HashMap, .Locale, .Map, .Objects, .Optional, .Set, jdk.internal.net.http.common.HttpHeadersBuilder, .Utils

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
pack-priv HttpRequest.BodyPublisher
public HttpRequest
build()

Implements java.net.http.HttpRequest.Builder.build.

Builds and returns an HttpRequest.

public HttpRequestImpl
private void
pack-priv static void
public HttpRequestBuilderImpl
copy()

Implements java.net.http.HttpRequest.Builder.copy.

Returns an exact duplicate copy of this Builder based on current state.

public static Map<HttpOption<?>, Object>
public static Map<HttpOption<?>, Object>
public HttpRequest.Builder
DELETE()

Implements java.net.http.HttpRequest.Builder.DELETE.

Sets the request method of this builder to DELETE.

public HttpRequestBuilderImpl
expectContinue(boolean enable)

Implements java.net.http.HttpRequest.Builder.expectContinue.

Requests the server to acknowledge the request before sending the body.

pack-priv boolean
public HttpRequest.Builder
GET()

Implements java.net.http.HttpRequest.Builder.GET.

Sets the request method of this builder to GET.

public HttpRequest.Builder
HEAD()

Overrides default java.net.http.HttpRequest.Builder.HEAD.

Sets the request method of this builder to HEAD.

public HttpRequestBuilderImpl
header(String name, String value)

Implements java.net.http.HttpRequest.Builder.header.

Adds the given name value pair to the set of headers for this request.

public HttpRequestBuilderImpl
headers(String... params)

Implements java.net.http.HttpRequest.Builder.headers.

Adds the given name value pairs to the set of headers for this request.

pack-priv HttpHeadersBuilder
pack-priv String
public HttpRequest.Builder
method(String method, HttpRequest.BodyPublisher body)

Implements java.net.http.HttpRequest.Builder.method.

Sets the request method and request body of this builder to the given values.

private HttpRequest.Builder
pack-priv Map<HttpOption<?>, Object>
public HttpRequest.Builder
POST(HttpRequest.BodyPublisher body)

Implements java.net.http.HttpRequest.Builder.POST.

Sets the request method of this builder to POST and sets its request body publisher to the given value.

public HttpRequest.Builder
PUT(HttpRequest.BodyPublisher body)

Implements java.net.http.HttpRequest.Builder.PUT.

Sets the request method of this builder to PUT and sets its request body publisher to the given value.

public HttpRequestBuilderImpl
setHeader(String name, String value)

Implements java.net.http.HttpRequest.Builder.setHeader.

Sets the given name value pair to the set of headers for this request.

public <T> HttpRequest.Builder
setOption(HttpOption<T> option, T value)

Overrides default java.net.http.HttpRequest.Builder.setOption.

Provides request configuration option hints modeled as key value pairs to help an HttpClient implementation decide how the request/response exchange should be established or carried out.

public HttpRequest.Builder
timeout(Duration duration)

Implements java.net.http.HttpRequest.Builder.timeout.

Sets a timeout for this request.

pack-priv Duration
public HttpRequestBuilderImpl
uri(URI uri)

Implements java.net.http.HttpRequest.Builder.uri.

Sets this HttpRequest's request URI.

pack-priv URI
uri()

public HttpRequestBuilderImpl
version(HttpClient.Version version)

Implements java.net.http.HttpRequest.Builder.version.

Sets the preferred HttpClient.Version for this request.

pack-priv Optional<HttpClient.Version>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bodyPublisherback to summary
private HttpRequest.BodyPublisher bodyPublisher
durationback to summary
private Duration duration
expectContinueback to summary
private boolean expectContinue
headersBuilderback to summary
private HttpHeadersBuilder headersBuilder
methodback to summary
private String method
optionsback to summary
private final Map<HttpOption<?>, Object> options
supportedOptionsback to summary
private static final Set<HttpOption<?>> supportedOptions
uriback to summary
private URI uri
versionback to summary
private volatile Optional<HttpClient.Version> version

Constructor Detail

HttpRequestBuilderImplback to summary
public HttpRequestBuilderImpl(URI uri)
HttpRequestBuilderImplback to summary
public HttpRequestBuilderImpl()

Method Detail

bodyPublisherback to summary
pack-priv HttpRequest.BodyPublisher bodyPublisher()
buildback to summary
public HttpRequest build()

Implements java.net.http.HttpRequest.Builder.build.

Doc from java.net.http.HttpRequest.Builder.build.

Builds and returns an HttpRequest.

Annotations
@Override
buildForWebSocketback to summary
public HttpRequestImpl buildForWebSocket()
checkNameAndValueback to summary
private void checkNameAndValue(String name, String value)
checkURIback to summary
pack-priv static void checkURI(URI uri)
copyback to summary
public HttpRequestBuilderImpl copy()

Implements java.net.http.HttpRequest.Builder.copy.

Doc from java.net.http.HttpRequest.Builder.copy.

Returns an exact duplicate copy of this Builder based on current state. The new builder can then be modified independently of this builder.

Annotations
@Override
copySupportedOptionsback to summary
public static Map<HttpOption<?>, Object> copySupportedOptions(HttpRequest request)
copySupportedOptionsback to summary
public static Map<HttpOption<?>, Object> copySupportedOptions(Map<HttpOption<?>, Object> options)
DELETEback to summary
public HttpRequest.Builder DELETE()

Implements java.net.http.HttpRequest.Builder.DELETE.

Doc from java.net.http.HttpRequest.Builder.DELETE.

Sets the request method of this builder to DELETE.

Annotations
@Override
expectContinueback to summary
public HttpRequestBuilderImpl expectContinue(boolean enable)

Implements java.net.http.HttpRequest.Builder.expectContinue.

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

Requests the server to acknowledge the request before sending the body. This is disabled by default. If enabled, the server is requested to send an error response or a 100 Continue response before the client sends the request body. This means the request publisher for the request will not be invoked until this interim response is received.

Annotations
@Override
expectContinueback to summary
pack-priv boolean expectContinue()
GETback to summary
public HttpRequest.Builder GET()

Implements java.net.http.HttpRequest.Builder.GET.

Doc from java.net.http.HttpRequest.Builder.GET.

Sets the request method of this builder to GET. This is the default.

Annotations
@Override
HEADback to summary
public HttpRequest.Builder HEAD()

Overrides default java.net.http.HttpRequest.Builder.HEAD.

Doc from java.net.http.HttpRequest.Builder.HEAD.

Sets the request method of this builder to HEAD.

Annotations
@Override
headerback to summary
public HttpRequestBuilderImpl header(String name, String value)

Implements java.net.http.HttpRequest.Builder.header.

Doc from java.net.http.HttpRequest.Builder.header.

Adds the given name value pair to the set of headers for this request. The given value is added to the list of values for that name.

Annotations
@Override
headersback to summary
public HttpRequestBuilderImpl headers(String... params)

Implements java.net.http.HttpRequest.Builder.headers.

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

Adds the given name value pairs to the set of headers for this request. The supplied String instances must alternate as header names and header values. To add several values to the same name then the same name must be supplied with each new value.

Annotations
@Override
headersBuilderback to summary
pack-priv HttpHeadersBuilder headersBuilder()
methodback to summary
pack-priv String method()
methodback to summary
public HttpRequest.Builder method(String method, HttpRequest.BodyPublisher body)

Implements java.net.http.HttpRequest.Builder.method.

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

Sets the request method and request body of this builder to the given values.

Annotations
@Override
method0back to summary
private HttpRequest.Builder method0(String method, HttpRequest.BodyPublisher body)
optionsback to summary
pack-priv Map<HttpOption<?>, Object> options()
POSTback to summary
public HttpRequest.Builder POST(HttpRequest.BodyPublisher body)

Implements java.net.http.HttpRequest.Builder.POST.

Doc from java.net.http.HttpRequest.Builder.POST.

Sets the request method of this builder to POST and sets its request body publisher to the given value.

Annotations
@Override
PUTback to summary
public HttpRequest.Builder PUT(HttpRequest.BodyPublisher body)

Implements java.net.http.HttpRequest.Builder.PUT.

Doc from java.net.http.HttpRequest.Builder.PUT.

Sets the request method of this builder to PUT and sets its request body publisher to the given value.

Annotations
@Override
setHeaderback to summary
public HttpRequestBuilderImpl setHeader(String name, String value)

Implements java.net.http.HttpRequest.Builder.setHeader.

Doc from java.net.http.HttpRequest.Builder.setHeader.

Sets the given name value pair to the set of headers for this request. This overwrites any previously set values for name.

Annotations
@Override
setOptionback to summary
public <T> HttpRequest.Builder setOption(HttpOption<T> option, T value)

Overrides default java.net.http.HttpRequest.Builder.setOption.

Doc from java.net.http.HttpRequest.Builder.setOption.

Provides request configuration option hints modeled as key value pairs to help an HttpClient implementation decide how the request/response exchange should be established or carried out.

An HttpClient implementation may decide to ignore request configuration option hints, or fail the request, if provided with any option hints that it does not understand.

If this method is invoked twice for the same request option, any value previously provided to this builder for the corresponding option is replaced by the new value. If null is supplied as a value, any value previously provided is discarded.

Annotations
@Override
timeoutback to summary
public HttpRequest.Builder timeout(Duration duration)

Implements java.net.http.HttpRequest.Builder.timeout.

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

Sets a timeout for this request. If the response is not received within the specified timeout then an HttpTimeoutException is thrown from HttpClient::send or HttpClient::sendAsync completes exceptionally with an HttpTimeoutException. The effect of not setting a timeout is the same as setting an infinite Duration, i.e., block forever.

Annotations
@Override
timeoutback to summary
pack-priv Duration timeout()
uriback to summary
public HttpRequestBuilderImpl uri(URI uri)

Implements java.net.http.HttpRequest.Builder.uri.

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

Sets this HttpRequest's request URI.

Annotations
@Override
uriback to summary
pack-priv URI uri()
versionback to summary
public HttpRequestBuilderImpl version(HttpClient.Version version)

Implements java.net.http.HttpRequest.Builder.version.

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

Sets the preferred HttpClient.Version for this request.

The corresponding HttpResponse should be checked for the version that was actually used. If the version is not set in a request, then the version requested will be that of the sending HttpClient.

Annotations
@Override
versionback to summary
pack-priv Optional<HttpClient.Version> version()