Top Description Inners Fields Constructors Methods
org.springframework.http.client

pack-priv Class JdkClientHttpRequest

extends AbstractStreamingClientHttpRequest
Class Inheritance
Imports
java.io.IOException, .InputStream, .UncheckedIOException, java.net.URI, java.net.http.HttpClient, java.net.http.HttpRequest, java.net.http.HttpResponse, java.nio.ByteBuffer, java.time.Duration, java.util.Collections, .Set, .TreeSet, java.util.concurrent.ExecutionException, .Executor, .Flow, .TimeUnit, .TimeoutException, org.springframework.http.HttpHeaders, .HttpMethod, org.springframework.lang.Nullable, org.springframework.util.StreamUtils, .StringUtils

ClientHttpRequest implementation based the Java HttpClient. Created via the JdkClientHttpRequestFactory.
Authors
Marten Deinum, Arjen Poutsma
Since
6.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final OutputStreamPublisher.ByteMapper<ByteBuffer>
private static final Set<String>
private final Executor
private final java.net.http.HttpClient
private final HttpMethod
private final Duration
private final URI

Constructor Summary

AccessConstructor and Description
public
JdkClientHttpRequest(java.net.http.HttpClient httpClient, URI uri, HttpMethod method, Executor executor, Duration readTimeout)

Method Summary

Modifier and TypeMethod and Description
private java.net.http.HttpRequest.BodyPublisher
private java.net.http.HttpRequest
private static Set<String>
disallowedHeaders()

By default, HttpRequest does not allow Connection, Content-Length, Expect, Host, or Upgrade headers to be set, but this can be overriden with the jdk.httpclient.allowRestrictedHeaders system property.

protected ClientHttpResponse
executeInternal(HttpHeaders
the HTTP headers
headers
,
StreamingHttpOutputMessage.Body
the HTTP body, may be null if no body was set
body
)

Implements abstract org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Abstract template method that writes the given headers and content to the HTTP request.

public HttpMethod
getMethod()

Implements org.springframework.http.HttpRequest.getMethod.

Return the HTTP method of the request.

public URI
getURI()

Implements org.springframework.http.HttpRequest.getURI.

Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).

Inherited from org.springframework.http.client.AbstractStreamingClientHttpRequest:
executeInternalgetBodyInternalsetBody

Field Detail

BYTE_MAPPERback to summary
private static final OutputStreamPublisher.ByteMapper<ByteBuffer> BYTE_MAPPER
DISALLOWED_HEADERSback to summary
private static final Set<String> DISALLOWED_HEADERS
executorback to summary
private final Executor executor
httpClientback to summary
private final java.net.http.HttpClient httpClient
methodback to summary
private final HttpMethod method
timeoutback to summary
private final Duration timeout
Annotations
@Nullable
uriback to summary
private final URI uri

Constructor Detail

JdkClientHttpRequestback to summary
public JdkClientHttpRequest(java.net.http.HttpClient httpClient, URI uri, HttpMethod method, Executor executor, Duration readTimeout)

Method Detail

bodyPublisherback to summary
private java.net.http.HttpRequest.BodyPublisher bodyPublisher(HttpHeaders headers, StreamingHttpOutputMessage.Body body)
buildRequestback to summary
private java.net.http.HttpRequest buildRequest(HttpHeaders headers, StreamingHttpOutputMessage.Body body)
disallowedHeadersback to summary
private static Set<String> disallowedHeaders()

By default, HttpRequest does not allow Connection, Content-Length, Expect, Host, or Upgrade headers to be set, but this can be overriden with the jdk.httpclient.allowRestrictedHeaders system property.

See Also
jdk.internal.net.http.common.Utils#getDisallowedHeaders()
executeInternalback to summary
protected ClientHttpResponse executeInternal(HttpHeaders headers, StreamingHttpOutputMessage.Body body) throws IOException

Implements abstract org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Doc from org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Abstract template method that writes the given headers and content to the HTTP request.

Parameters
headers:HttpHeaders

the HTTP headers

body:StreamingHttpOutputMessage.Body

the HTTP body, may be null if no body was set

Returns:ClientHttpResponse

the response object for the executed request

Annotations
@Override
getMethodback to summary
public HttpMethod getMethod()

Implements org.springframework.http.HttpRequest.getMethod.

Doc from org.springframework.http.HttpRequest.getMethod.

Return the HTTP method of the request.

Returns:HttpMethod

the HTTP method as an HttpMethod value

Annotations
@Override
getURIback to summary
public URI getURI()

Implements org.springframework.http.HttpRequest.getURI.

Doc from org.springframework.http.HttpRequest.getURI.

Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).

Returns:URI

the URI of the request (never null)

Annotations
@Override
org.springframework.http.client back to summary

private final Class JdkClientHttpRequest.ByteBufferMapper

extends Object
implements OutputStreamPublisher.ByteMapper<ByteBuffer>
Class Inheritance
  • java.lang.Object
  • org.springframework.http.client.JdkClientHttpRequest.ByteBufferMapper
All Implemented Interfaces
org.springframework.http.client.OutputStreamPublisher.ByteMapper

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer
public ByteBuffer
map(byte[] b, int off, int len)

Implements org.springframework.http.client.OutputStreamPublisher.ByteMapper.map.

Maps a byte array to T.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ByteBufferMapperback to summary
private ByteBufferMapper()

Method Detail

mapback to summary
public ByteBuffer map(int b)

Implements org.springframework.http.client.OutputStreamPublisher.ByteMapper.map.

Doc from org.springframework.http.client.OutputStreamPublisher.ByteMapper.map.

Maps a single byte to T.

Annotations
@Override
mapback to summary
public ByteBuffer map(byte[] b, int off, int len)

Implements org.springframework.http.client.OutputStreamPublisher.ByteMapper.map.

Doc from org.springframework.http.client.OutputStreamPublisher.ByteMapper.map.

Maps a byte array to T.

Annotations
@Override