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

pack-priv Class JdkClientHttpRequest

extends AbstractClientHttpRequest
Class Inheritance
Imports
java.net.URI, java.net.http.HttpClient, java.net.http.HttpRequest, java.nio.ByteBuffer, java.util.List, .Map, java.util.concurrent.Flow, java.util.function.Function, java.util.stream.Collectors, org.reactivestreams.Publisher, reactor.adapter.JdkFlowAdapter, reactor.core.publisher.Flux, .Mono, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, org.springframework.http.HttpCookie, .HttpHeaders, .HttpMethod, org.springframework.util.Assert

ClientHttpRequest for the Java HttpClient.
Authors
Julien Eyraud, Rossen Stoyanchev
Since
6.0

Field Summary

Modifier and TypeField and Description
private final DataBufferFactory
private final java.net.http.HttpRequest.Builder
private final HttpMethod
private final URI

Constructor Summary

AccessConstructor and Description
public
JdkClientHttpRequest(HttpMethod httpMethod, URI uri, DataBufferFactory bufferFactory)

Method Summary

Modifier and TypeMethod and Description
protected void
applyCookies()

Implements abstract org.springframework.http.client.reactive.AbstractClientHttpRequest.applyCookies.

Add cookies from getHeaders() to the underlying request.

protected void
applyHeaders()

Implements abstract org.springframework.http.client.reactive.AbstractClientHttpRequest.applyHeaders.

Apply header changes from getHeaders() to the underlying request.

public DataBufferFactory
public HttpMethod
getMethod()

Implements org.springframework.http.client.reactive.ClientHttpRequest.getMethod.

Return the HTTP method of the request.

public <T> T
getNativeRequest()

Implements org.springframework.http.client.reactive.ClientHttpRequest.getNativeRequest.

Return the request from the underlying HTTP library.

public URI
public Mono<Void>
setComplete()

Implements org.springframework.http.ReactiveHttpOutputMessage.setComplete.

Indicate that message handling is complete, allowing for any cleanup or end-of-processing tasks to be performed such as applying header changes made via getHeaders() to the underlying HTTP message (if not applied already).

private java.net.http.HttpRequest.BodyPublisher
private ByteBuffer
public Mono<Void>
writeAndFlushWith(final Publisher<? extends Publisher<? extends DataBuffer>>
the body content publisher
body
)

Implements org.springframework.http.ReactiveHttpOutputMessage.writeAndFlushWith.

Use the given Publisher of Publishers to write the body of the HttpOutputMessage to the underlying HTTP layer, flushing after each Publisher<DataBuffer>.

public Mono<Void>
writeWith(Publisher<? extends DataBuffer>
the body content publisher
body
)

Implements org.springframework.http.ReactiveHttpOutputMessage.writeWith.

Use the given Publisher to write the body of the message to the underlying HTTP layer.

Inherited from org.springframework.http.client.reactive.AbstractClientHttpRequest:
beforeCommitdoCommitdoCommitgetCookiesgetHeadersinitReadOnlyHeadersisCommitted

Field Detail

bufferFactoryback to summary
private final DataBufferFactory bufferFactory
builderback to summary
private final java.net.http.HttpRequest.Builder builder
methodback to summary
private final HttpMethod method
uriback to summary
private final URI uri

Constructor Detail

JdkClientHttpRequestback to summary
public JdkClientHttpRequest(HttpMethod httpMethod, URI uri, DataBufferFactory bufferFactory)

Method Detail

applyCookiesback to summary
protected void applyCookies()

Implements abstract org.springframework.http.client.reactive.AbstractClientHttpRequest.applyCookies.

Doc from org.springframework.http.client.reactive.AbstractClientHttpRequest.applyCookies.

Add cookies from getHeaders() to the underlying request. This method is called once only.

Annotations
@Override
applyHeadersback to summary
protected void applyHeaders()

Implements abstract org.springframework.http.client.reactive.AbstractClientHttpRequest.applyHeaders.

Doc from org.springframework.http.client.reactive.AbstractClientHttpRequest.applyHeaders.

Apply header changes from getHeaders() to the underlying request. This method is called once only.

Annotations
@Override
bufferFactoryback to summary
public DataBufferFactory bufferFactory()

Implements org.springframework.http.ReactiveHttpOutputMessage.bufferFactory.

Doc from org.springframework.http.ReactiveHttpOutputMessage.bufferFactory.

Return a DataBufferFactory that can be used to create the body.

Returns:DataBufferFactory

a buffer factory

Annotations
@Override
getMethodback to summary
public HttpMethod getMethod()

Implements org.springframework.http.client.reactive.ClientHttpRequest.getMethod.

Doc from org.springframework.http.client.reactive.ClientHttpRequest.getMethod.

Return the HTTP method of the request.

Annotations
@Override
getNativeRequestback to summary
public <T> T getNativeRequest()

Implements org.springframework.http.client.reactive.ClientHttpRequest.getNativeRequest.

Doc from org.springframework.http.client.reactive.ClientHttpRequest.getNativeRequest.

Return the request from the underlying HTTP library.

Parameters
<T>
the expected type of the request to cast to
Annotations
@Override
@SuppressWarnings:unchecked
getURIback to summary
public URI getURI()

Implements org.springframework.http.client.reactive.ClientHttpRequest.getURI.

Doc from org.springframework.http.client.reactive.ClientHttpRequest.getURI.

Return the URI of the request.

Annotations
@Override
setCompleteback to summary
public Mono<Void> setComplete()

Implements org.springframework.http.ReactiveHttpOutputMessage.setComplete.

Doc from org.springframework.http.ReactiveHttpOutputMessage.setComplete.

Indicate that message handling is complete, allowing for any cleanup or end-of-processing tasks to be performed such as applying header changes made via getHeaders() to the underlying HTTP message (if not applied already).

This method should be automatically invoked at the end of message processing so typically applications should not have to invoke it. If invoked multiple times it should have no side effects.

Returns:Mono<Void>

a Mono that indicates completion or error

Annotations
@Override
toBodyPublisherback to summary
private java.net.http.HttpRequest.BodyPublisher toBodyPublisher(Publisher<? extends DataBuffer> body)
toByteBufferback to summary
private ByteBuffer toByteBuffer(DataBuffer dataBuffer)
writeAndFlushWithback to summary
public Mono<Void> writeAndFlushWith(final Publisher<? extends Publisher<? extends DataBuffer>> body)

Implements org.springframework.http.ReactiveHttpOutputMessage.writeAndFlushWith.

Doc from org.springframework.http.ReactiveHttpOutputMessage.writeAndFlushWith.

Use the given Publisher of Publishers to write the body of the HttpOutputMessage to the underlying HTTP layer, flushing after each Publisher<DataBuffer>.

Parameters
body:Publisher<? extends Publisher<? extends DataBuffer>>

the body content publisher

Returns:Mono<Void>

a Mono that indicates completion or error

Annotations
@Override
writeWithback to summary
public Mono<Void> writeWith(Publisher<? extends DataBuffer> body)

Implements org.springframework.http.ReactiveHttpOutputMessage.writeWith.

Doc from org.springframework.http.ReactiveHttpOutputMessage.writeWith.

Use the given Publisher to write the body of the message to the underlying HTTP layer.

Parameters
body:Publisher<? extends DataBuffer>

the body content publisher

Returns:Mono<Void>

a Mono that indicates completion or error

Annotations
@Override