org.springframework.http.server
Class ServletServerHttpResponse

java.lang.Object
  extended by org.springframework.http.server.ServletServerHttpResponse
All Implemented Interfaces:
HttpMessage, HttpOutputMessage, ServerHttpResponse

public class ServletServerHttpResponse
extends java.lang.Object
implements ServerHttpResponse

ServerHttpResponse implementation that is based on a HttpServletResponse.

Since:
3.0
Author:
Arjen Poutsma

Field Summary
private  HttpHeaders headers
           
private  boolean headersWritten
           
private  HttpServletResponse servletResponse
           
 
Constructor Summary
ServletServerHttpResponse(HttpServletResponse servletResponse)
          Construct a new instance of the ServletServerHttpResponse based on the given HttpServletResponse.
 
Method Summary
 void close()
          Close this response, freeing any resources created.
 java.io.OutputStream getBody()
          Return the body of the message as an output stream.
 HttpHeaders getHeaders()
          Return the headers of this message.
 HttpServletResponse getServletResponse()
          Return the HttpServletResponse this object is based on.
 void setStatusCode(HttpStatus status)
          Set the HTTP status code of the response.
private  void writeHeaders()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletResponse

private final HttpServletResponse servletResponse

headers

private final HttpHeaders headers

headersWritten

private boolean headersWritten
Constructor Detail

ServletServerHttpResponse

public ServletServerHttpResponse(HttpServletResponse servletResponse)
Construct a new instance of the ServletServerHttpResponse based on the given HttpServletResponse.

Parameters:
servletResponse - the servlet response
Method Detail

getServletResponse

public HttpServletResponse getServletResponse()
Return the HttpServletResponse this object is based on.


setStatusCode

public void setStatusCode(HttpStatus status)
Description copied from interface: ServerHttpResponse
Set the HTTP status code of the response.

Specified by:
setStatusCode in interface ServerHttpResponse
Parameters:
status - the HTTP status as an HttpStatus enum value

getHeaders

public HttpHeaders getHeaders()
Description copied from interface: HttpMessage
Return the headers of this message.

Specified by:
getHeaders in interface HttpMessage
Returns:
a corresponding HttpHeaders object

getBody

public java.io.OutputStream getBody()
                             throws java.io.IOException
Description copied from interface: HttpOutputMessage
Return the body of the message as an output stream.

Specified by:
getBody in interface HttpOutputMessage
Returns:
the output stream body
Throws:
java.io.IOException - in case of I/O Errors

close

public void close()
Description copied from interface: ServerHttpResponse
Close this response, freeing any resources created.

Specified by:
close in interface ServerHttpResponse

writeHeaders

private void writeHeaders()