org.springframework.http.client
Class SimpleStreamingClientHttpRequest

java.lang.Object
  extended by org.springframework.http.client.AbstractClientHttpRequest
      extended by org.springframework.http.client.SimpleStreamingClientHttpRequest
All Implemented Interfaces:
ClientHttpRequest, HttpMessage, HttpOutputMessage, HttpRequest

final class SimpleStreamingClientHttpRequest
extends AbstractClientHttpRequest

ClientHttpRequest implementation that uses standard J2SE facilities to execute streaming requests. Created via the SimpleClientHttpRequestFactory.

Since:
3.0
Author:
Arjen Poutsma
See Also:
SimpleClientHttpRequestFactory.createRequest(java.net.URI, HttpMethod)

Nested Class Summary
private static class SimpleStreamingClientHttpRequest.NonClosingOutputStream
           
 
Field Summary
private  java.io.OutputStream body
           
private  int chunkSize
           
private  java.net.HttpURLConnection connection
           
 
Constructor Summary
SimpleStreamingClientHttpRequest(java.net.HttpURLConnection connection, int chunkSize)
           
 
Method Summary
protected  ClientHttpResponse executeInternal(HttpHeaders headers)
          Abstract template method that writes the given headers and content to the HTTP request.
protected  java.io.OutputStream getBodyInternal(HttpHeaders headers)
          Abstract template method that returns the body.
 HttpMethod getMethod()
          Return the HTTP method of the request.
 java.net.URI getURI()
          Return the URI of the request.
 
Methods inherited from class org.springframework.http.client.AbstractClientHttpRequest
execute, getBody, getHeaders
 
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

chunkSize

private final int chunkSize

body

private java.io.OutputStream body
Constructor Detail

SimpleStreamingClientHttpRequest

SimpleStreamingClientHttpRequest(java.net.HttpURLConnection connection,
                                 int chunkSize)
Method Detail

getMethod

public HttpMethod getMethod()
Description copied from interface: HttpRequest
Return the HTTP method of the request.

Returns:
the HTTP method as an HttpMethod enum value

getURI

public java.net.URI getURI()
Description copied from interface: HttpRequest
Return the URI of the request.

Returns:
the URI of the request

getBodyInternal

protected java.io.OutputStream getBodyInternal(HttpHeaders headers)
                                        throws java.io.IOException
Description copied from class: AbstractClientHttpRequest
Abstract template method that returns the body.

Specified by:
getBodyInternal in class AbstractClientHttpRequest
Parameters:
headers - the HTTP headers
Returns:
the body output stream
Throws:
java.io.IOException

executeInternal

protected ClientHttpResponse executeInternal(HttpHeaders headers)
                                      throws java.io.IOException
Description copied from class: AbstractClientHttpRequest
Abstract template method that writes the given headers and content to the HTTP request.

Specified by:
executeInternal in class AbstractClientHttpRequest
Parameters:
headers - the HTTP headers
Returns:
the response object for the executed request
Throws:
java.io.IOException