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

public Class DelegatingServerHttpResponse

extends Object
implements ServerHttpResponse
Class Inheritance
All Implemented Interfaces
org.springframework.http.server.ServerHttpResponse, java.io.Closeable, java.lang.AutoCloseable, java.io.Flushable, org.springframework.http.HttpOutputMessage, org.springframework.http.HttpMessage
Imports
java.io.IOException, .OutputStream, org.springframework.http.HttpHeaders, .HttpStatusCode, org.springframework.util.Assert

Implementation of ServerHttpResponse that delegates all calls to a given target ServerHttpResponse.
Author
Arjen Poutsma
Since
5.3.2

Field Summary

Modifier and TypeField and Description
private final ServerHttpResponse

Constructor Summary

AccessConstructor and Description
public
DelegatingServerHttpResponse(ServerHttpResponse
the response to delegate to
delegate
)

Create a new DelegatingServerHttpResponse.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements org.springframework.http.server.ServerHttpResponse.close.

Close this response, freeing any resources created.

public void
flush()

Implements org.springframework.http.server.ServerHttpResponse.flush.

Ensure that the headers and the content of the response are written out.

public OutputStream
getBody()

Implements org.springframework.http.HttpOutputMessage.getBody.

Return the body of the message as an output stream.

public ServerHttpResponse

Returns:

the delegate
getDelegate
()

Returns the target response that this response delegates to.

public HttpHeaders
getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

public void
setStatusCode(HttpStatusCode
the HTTP status as an HttpStatus enum value
status
)

Implements org.springframework.http.server.ServerHttpResponse.setStatusCode.

Set the HTTP status code of the response.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final ServerHttpResponse delegate

Constructor Detail

DelegatingServerHttpResponseback to summary
public DelegatingServerHttpResponse(ServerHttpResponse delegate)

Create a new DelegatingServerHttpResponse.

Parameters
delegate:ServerHttpResponse

the response to delegate to

Method Detail

closeback to summary
public void close()

Implements org.springframework.http.server.ServerHttpResponse.close.

Doc from org.springframework.http.server.ServerHttpResponse.close.

Close this response, freeing any resources created.

Annotations
@Override
flushback to summary
public void flush() throws IOException

Implements org.springframework.http.server.ServerHttpResponse.flush.

Doc from org.springframework.http.server.ServerHttpResponse.flush.

Ensure that the headers and the content of the response are written out.

After the first flush, headers can no longer be changed. Only further content writing and content flushing is possible.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Flushable.flush.

If an I/O error occurs

getBodyback to summary
public OutputStream getBody() throws IOException

Implements org.springframework.http.HttpOutputMessage.getBody.

Doc from org.springframework.http.HttpOutputMessage.getBody.

Return the body of the message as an output stream.

Returns:OutputStream

the output stream body (never null)

Annotations
@Override
Exceptions
IOException:
in case of I/O errors
getDelegateback to summary
public ServerHttpResponse getDelegate()

Returns the target response that this response delegates to.

Returns:ServerHttpResponse

the delegate

getHeadersback to summary
public HttpHeaders getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Doc from org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

Returns:HttpHeaders

a corresponding HttpHeaders object (never null)

Annotations
@Override
setStatusCodeback to summary
public void setStatusCode(HttpStatusCode status)

Implements org.springframework.http.server.ServerHttpResponse.setStatusCode.

Doc from org.springframework.http.server.ServerHttpResponse.setStatusCode.

Set the HTTP status code of the response.

Parameters
status:HttpStatusCode

the HTTP status as an HttpStatus enum value

Annotations
@Override