org.springframework.http.client
Class SimpleClientHttpResponse

java.lang.Object
  extended by org.springframework.http.client.SimpleClientHttpResponse
All Implemented Interfaces:
ClientHttpResponse, HttpInputMessage, HttpMessage

final class SimpleClientHttpResponse
extends java.lang.Object
implements ClientHttpResponse

ClientHttpResponse implementation that uses standard J2SE facilities. Obtained via the AbstractClientHttpRequest.execute().

Since:
3.0
Author:
Arjen Poutsma

Field Summary
private  java.net.HttpURLConnection connection
           
private  HttpHeaders headers
           
 
Constructor Summary
SimpleClientHttpResponse(java.net.HttpURLConnection connection)
           
 
Method Summary
 void close()
          Closes this response, freeing any resources created.
 java.io.InputStream getBody()
          Return the body of the message as an input stream.
 HttpHeaders getHeaders()
          Return the headers of this message.
 HttpStatus getStatusCode()
          Return the HTTP status code of the response.
 java.lang.String getStatusText()
          Return the HTTP status text of the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

private final java.net.HttpURLConnection connection

headers

private HttpHeaders headers
Constructor Detail

SimpleClientHttpResponse

SimpleClientHttpResponse(java.net.HttpURLConnection connection)
Method Detail

getStatusCode

public HttpStatus getStatusCode()
                         throws java.io.IOException
Description copied from interface: ClientHttpResponse
Return the HTTP status code of the response.

Specified by:
getStatusCode in interface ClientHttpResponse
Returns:
the HTTP status as an HttpStatus enum value
Throws:
java.io.IOException - in case of I/O errors

getStatusText

public java.lang.String getStatusText()
                               throws java.io.IOException
Description copied from interface: ClientHttpResponse
Return the HTTP status text of the response.

Specified by:
getStatusText in interface ClientHttpResponse
Returns:
the HTTP status text
Throws:
java.io.IOException - in case of I/O errors

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.InputStream getBody()
                            throws java.io.IOException
Description copied from interface: HttpInputMessage
Return the body of the message as an input stream.

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

close

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

Specified by:
close in interface ClientHttpResponse