class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse implements ZeroCopyHttpOutputMessage
ServerHttpResponse
to the Undertow HttpServerExchange
.Modifier and Type | Class and Description |
---|---|
private class |
UndertowServerHttpResponse.ResponseBodyFlushProcessor |
private class |
UndertowServerHttpResponse.ResponseBodyProcessor |
private static class |
UndertowServerHttpResponse.TransferBodyListener |
Modifier and Type | Field and Description |
---|---|
private HttpServerExchange |
exchange |
private UndertowServerHttpRequest |
request |
private StreamSinkChannel |
responseChannel |
logger
Constructor and Description |
---|
UndertowServerHttpResponse(HttpServerExchange exchange,
DataBufferFactory bufferFactory,
UndertowServerHttpRequest request) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyCookies()
Add cookies from
AbstractServerHttpResponse.getHeaders() to the underlying response. |
protected void |
applyHeaders()
Apply header changes from
AbstractServerHttpResponse.getHeaders() to the underlying response. |
protected void |
applyStatusCode()
Write the status code to the underlying response.
|
protected <any> |
createBodyFlushProcessor()
Abstract template method to create a
Processor<Publisher<DataBuffer>, Void>
that will write the response body with flushes to the underlying output. |
private UndertowServerHttpResponse.ResponseBodyProcessor |
createBodyProcessor() |
private static HttpHeaders |
createHeaders(HttpServerExchange exchange) |
<T> T |
getNativeResponse()
Return the underlying server response.
|
HttpStatus |
getStatusCode()
Return the status code set via
ServerHttpResponse.setStatusCode(org.springframework.http.HttpStatus) , or if the status
has not been set, return the default status code from the underlying
server response. |
<any> |
writeWith(java.nio.file.Path file,
long position,
long count)
Use the given
Path to write the body of the message to the underlying
HTTP layer. |
writeAndFlushWithInternal, writeWithInternal
addCookie, beforeCommit, bufferFactory, doCommit, doCommit, getCookies, getHeaders, getStatusCodeValue, isCommitted, setComplete, setStatusCode, setStatusCodeValue, writeAndFlushWith, writeWith
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
writeWith
beforeCommit, bufferFactory, isCommitted, setComplete, writeAndFlushWith, writeWith
getHeaders
private final HttpServerExchange exchange
private final UndertowServerHttpRequest request
@Nullable private StreamSinkChannel responseChannel
UndertowServerHttpResponse(HttpServerExchange exchange, DataBufferFactory bufferFactory, UndertowServerHttpRequest request)
private static HttpHeaders createHeaders(HttpServerExchange exchange)
public <T> T getNativeResponse()
AbstractServerHttpResponse
Note: This is exposed mainly for internal framework use such as WebSocket upgrades in the spring-webflux module.
getNativeResponse
in class AbstractServerHttpResponse
public HttpStatus getStatusCode()
ServerHttpResponse
ServerHttpResponse.setStatusCode(org.springframework.http.HttpStatus)
, or if the status
has not been set, return the default status code from the underlying
server response. The return value may be null
if the status code
value is outside the HttpStatus
enum range, or if the underlying
server response does not have a default value.getStatusCode
in interface ServerHttpResponse
getStatusCode
in class AbstractServerHttpResponse
protected void applyStatusCode()
AbstractServerHttpResponse
applyStatusCode
in class AbstractServerHttpResponse
protected void applyHeaders()
AbstractServerHttpResponse
AbstractServerHttpResponse.getHeaders()
to the underlying response.
This method is called once only.applyHeaders
in class AbstractServerHttpResponse
protected void applyCookies()
AbstractServerHttpResponse
AbstractServerHttpResponse.getHeaders()
to the underlying response.
This method is called once only.applyCookies
in class AbstractServerHttpResponse
public <any> writeWith(java.nio.file.Path file, long position, long count)
ZeroCopyHttpOutputMessage
Path
to write the body of the message to the underlying
HTTP layer.writeWith
in interface ZeroCopyHttpOutputMessage
file
- the file to transferposition
- the position within the file from which the transfer is to begincount
- the number of bytes to be transferredprotected <any> createBodyFlushProcessor()
AbstractListenerServerHttpResponse
Processor<Publisher<DataBuffer>, Void>
that will write the response body with flushes to the underlying output. Called from
#writeAndFlushWithInternal(Publisher)
.createBodyFlushProcessor
in class AbstractListenerServerHttpResponse
private UndertowServerHttpResponse.ResponseBodyProcessor createBodyProcessor()