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

pack-priv Class ReactorNetty2ServerHttpResponse

extends AbstractServerHttpResponse
implements ZeroCopyHttpOutputMessage
Class Inheritance
All Implemented Interfaces
org.springframework.http.ZeroCopyHttpOutputMessage, org.springframework.http.ReactiveHttpOutputMessage, org.springframework.http.HttpMessage
Imports
java.nio.file.Path, io.netty5.buffer.Buffer, io.netty5.channel.ChannelId, io.netty5.handler.codec.http.headers.DefaultHttpSetCookie, .HttpSetCookie, org.apache.commons.logging.Log, .LogFactory, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, reactor.netty5.ChannelOperationsId, reactor.netty5.http.server.HttpServerResponse, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, .DataBufferUtils, .Netty5DataBufferFactory, org.springframework.http.HttpHeaders, .HttpStatusCode, .ResponseCookie, .ZeroCopyHttpOutputMessage, org.springframework.http.support.Netty5HeadersAdapter, org.springframework.util.Assert

Adapt ServerHttpResponse to the HttpServerResponse.

This class is based on ReactorServerHttpResponse.

Author
Violeta Georgieva
Since
6.0

Field Summary

Modifier and TypeField and Description
private static final Log
private final HttpServerResponse

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
applyCookies()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.applyCookies.

Add cookies from getHeaders() to the underlying response.

protected void
applyHeaders()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.applyHeaders.

Invoked when the response is getting committed allowing subclasses to make apply header values to the underlying response.

protected void
applyStatusCode()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.applyStatusCode.

Write the status code to the underlying response.

public <T> T
public Integer
getRawStatusCode()

Overrides org.springframework.http.server.reactive.AbstractServerHttpResponse.getRawStatusCode.

Overrides default org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode.

Deprecated

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.

public HttpStatusCode
getStatusCode()

Overrides org.springframework.http.server.reactive.AbstractServerHttpResponse.getStatusCode.

Implements org.springframework.http.server.reactive.ServerHttpResponse.getStatusCode.

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.

private Publisher<Buffer>
toByteBufs(Publisher<? extends DataBuffer> dataBuffers)

protected void
touchDataBuffer(DataBuffer
the buffer to attach a hint to
buffer
)

Overrides org.springframework.http.server.reactive.AbstractServerHttpResponse.touchDataBuffer.

Allow subclasses to associate a hint with the data buffer if it is a pooled buffer and supports leak tracking.

protected Mono<Void>
writeAndFlushWithInternal(Publisher<? extends Publisher<? extends DataBuffer>>
the publisher to write and flush with
publisher
)

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.writeAndFlushWithInternal.

Write to the underlying the response, and flush after each Publisher<DataBuffer>.

public Mono<Void>
writeWith(Path
the file to transfer
file
,
long
the position within the file from which the transfer is to begin
position
,
long
the number of bytes to be transferred
count
)

Implements org.springframework.http.ZeroCopyHttpOutputMessage.writeWith.

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

protected Mono<Void>
writeWithInternal(Publisher<? extends DataBuffer>
the publisher to write with
publisher
)

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.writeWithInternal.

Write to the underlying the response.

Inherited from org.springframework.http.server.reactive.AbstractServerHttpResponse:
addCookiebeforeCommitbufferFactorydoCommitdoCommitgetCookiesgetHeadersisCommittedsetCompletesetRawStatusCodesetStatusCodewriteAndFlushWithwriteWith

Field Detail

loggerback to summary
private static final Log logger
responseback to summary
private final HttpServerResponse response

Constructor Detail

ReactorNetty2ServerHttpResponseback to summary
public ReactorNetty2ServerHttpResponse(HttpServerResponse response, DataBufferFactory bufferFactory)

Method Detail

applyCookiesback to summary
protected void applyCookies()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.applyCookies.

Doc from org.springframework.http.server.reactive.AbstractServerHttpResponse.applyCookies.

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

Annotations
@Override
applyHeadersback to summary
protected void applyHeaders()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.applyHeaders.

Doc from org.springframework.http.server.reactive.AbstractServerHttpResponse.applyHeaders.

Invoked when the response is getting committed allowing subclasses to make apply header values to the underlying response.

Note that some subclasses use an HttpHeaders instance that wraps an adapter to the native response headers such that changes are propagated to the underlying response on the go. That means this callback might not be used other than for specialized updates such as setting the contentType or characterEncoding fields in a Servlet response.

Annotations
@Override
applyStatusCodeback to summary
protected void applyStatusCode()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.applyStatusCode.

Doc from org.springframework.http.server.reactive.AbstractServerHttpResponse.applyStatusCode.

Write the status code to the underlying response. This method is called once only.

Annotations
@Override
getNativeResponseback to summary
public <T> T getNativeResponse()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.getNativeResponse.

Doc from org.springframework.http.server.reactive.AbstractServerHttpResponse.getNativeResponse.

Return the underlying server response.

Note

This is exposed mainly for internal framework use such as WebSocket upgrades in the spring-webflux module.

Annotations
@SuppressWarnings:unchecked
@Override
getRawStatusCodeback to summary
public Integer getRawStatusCode()

Overrides org.springframework.http.server.reactive.AbstractServerHttpResponse.getRawStatusCode.

Overrides default org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode.

Deprecated

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server. The return value may be null if there is no default value from the underlying server.

Annotations
@Override
@Deprecated
getStatusCodeback to summary
public HttpStatusCode getStatusCode()

Overrides org.springframework.http.server.reactive.AbstractServerHttpResponse.getStatusCode.

Implements org.springframework.http.server.reactive.ServerHttpResponse.getStatusCode.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.getStatusCode.

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server. The return value may be null if there is no default value from the underlying server.

Annotations
@Override
toByteBufsback to summary
private Publisher<Buffer> toByteBufs(Publisher<? extends DataBuffer> dataBuffers)
touchDataBufferback to summary
protected void touchDataBuffer(DataBuffer buffer)

Overrides org.springframework.http.server.reactive.AbstractServerHttpResponse.touchDataBuffer.

Doc from org.springframework.http.server.reactive.AbstractServerHttpResponse.touchDataBuffer.

Allow subclasses to associate a hint with the data buffer if it is a pooled buffer and supports leak tracking.

Parameters
buffer:DataBuffer

the buffer to attach a hint to

Annotations
@Override
writeAndFlushWithInternalback to summary
protected Mono<Void> writeAndFlushWithInternal(Publisher<? extends Publisher<? extends DataBuffer>> publisher)

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.writeAndFlushWithInternal.

Doc from org.springframework.http.server.reactive.AbstractServerHttpResponse.writeAndFlushWithInternal.

Write to the underlying the response, and flush after each Publisher<DataBuffer>.

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

the publisher to write and flush with

Annotations
@Override
writeWithback to summary
public Mono<Void> writeWith(Path file, long position, long count)

Implements org.springframework.http.ZeroCopyHttpOutputMessage.writeWith.

Doc from org.springframework.http.ZeroCopyHttpOutputMessage.writeWith.

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

Parameters
file:Path

the file to transfer

position:long

the position within the file from which the transfer is to begin

count:long

the number of bytes to be transferred

Returns:Mono<Void>

a publisher that indicates completion or error.

Annotations
@Override
writeWithInternalback to summary
protected Mono<Void> writeWithInternal(Publisher<? extends DataBuffer> publisher)

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpResponse.writeWithInternal.

Doc from org.springframework.http.server.reactive.AbstractServerHttpResponse.writeWithInternal.

Write to the underlying the response.

Parameters
publisher:Publisher<? extends DataBuffer>

the publisher to write with

Annotations
@Override