Top Description Inners Fields Constructors Methods
org.springframework.http.client

pack-priv Class OkHttp3ClientHttpRequest

extends AbstractStreamingClientHttpRequest
Class Inheritance
Annotations
@Deprecated
since:6.1
forRemoval:true
Imports
java.io.IOException, java.net.URI, okhttp3.MediaType, okhttp3.OkHttpClient, okhttp3.Request, okhttp3.RequestBody, okio.BufferedSink, org.springframework.http.HttpHeaders, .HttpMethod, org.springframework.lang.Nullable, org.springframework.util.StringUtils

Deprecated

for removal since 6.1.

ClientHttpRequest implementation based on OkHttp 3.x.

Created via the OkHttp3ClientHttpRequestFactory.

Authors
Luciano Leggieri, Arjen Poutsma, Roy Clarkson
Since
4.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final okhttp3.OkHttpClient
private final HttpMethod
private final URI

Constructor Summary

AccessConstructor and Description
public
OkHttp3ClientHttpRequest(okhttp3.OkHttpClient client, URI uri, HttpMethod method)

Method Summary

Modifier and TypeMethod and Description
protected ClientHttpResponse
executeInternal(HttpHeaders
the HTTP headers
headers
,
StreamingHttpOutputMessage.Body
the HTTP body, may be null if no body was set
body
)

Implements abstract org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Abstract template method that writes the given headers and content to the HTTP request.

public HttpMethod
getMethod()

Implements org.springframework.http.HttpRequest.getMethod.

Return the HTTP method of the request.

public URI
getURI()

Implements org.springframework.http.HttpRequest.getURI.

Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).

Inherited from org.springframework.http.client.AbstractStreamingClientHttpRequest:
executeInternalgetBodyInternalsetBody

Field Detail

clientback to summary
private final okhttp3.OkHttpClient client
methodback to summary
private final HttpMethod method
uriback to summary
private final URI uri

Constructor Detail

OkHttp3ClientHttpRequestback to summary
public OkHttp3ClientHttpRequest(okhttp3.OkHttpClient client, URI uri, HttpMethod method)

Method Detail

executeInternalback to summary
protected ClientHttpResponse executeInternal(HttpHeaders headers, StreamingHttpOutputMessage.Body body) throws IOException

Implements abstract org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Doc from org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Abstract template method that writes the given headers and content to the HTTP request.

Parameters
headers:HttpHeaders

the HTTP headers

body:StreamingHttpOutputMessage.Body

the HTTP body, may be null if no body was set

Returns:ClientHttpResponse

the response object for the executed request

Annotations
@Override
@SuppressWarnings:removal
getMethodback to summary
public HttpMethod getMethod()

Implements org.springframework.http.HttpRequest.getMethod.

Doc from org.springframework.http.HttpRequest.getMethod.

Return the HTTP method of the request.

Returns:HttpMethod

the HTTP method as an HttpMethod value

Annotations
@Override
getURIback to summary
public URI getURI()

Implements org.springframework.http.HttpRequest.getURI.

Doc from org.springframework.http.HttpRequest.getURI.

Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).

Returns:URI

the URI of the request (never null)

Annotations
@Override
org.springframework.http.client back to summary

private Class OkHttp3ClientHttpRequest.BodyRequestBody

extends okhttp3.RequestBody
Class Inheritance
  • java.lang.Object
  • ⋱
  • okhttp3.RequestBody
  • org.springframework.http.client.OkHttp3ClientHttpRequest.BodyRequestBody

Field Summary

Modifier and TypeField and Description
private final StreamingHttpOutputMessage.Body
private final HttpHeaders

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long
public okhttp3.MediaType
public boolean
public void
writeTo(okio.BufferedSink sink)

Field Detail

bodyback to summary
private final StreamingHttpOutputMessage.Body body
headersback to summary
private final HttpHeaders headers

Constructor Detail

BodyRequestBodyback to summary
public BodyRequestBody(HttpHeaders headers, StreamingHttpOutputMessage.Body body)

Method Detail

contentLengthback to summary
public long contentLength()
Annotations
@Override
contentTypeback to summary
public okhttp3.MediaType contentType()
Annotations
@Nullable
@Override
isOneShotback to summary
public boolean isOneShot()
Annotations
@Override
writeToback to summary
public void writeTo(okio.BufferedSink sink) throws IOException
Annotations
@Override