类 AbstractClientHttpRequest
- java.lang.Object
- org.springframework.http.client.AbstractClientHttpRequest
- 所有已实现的接口:
ClientHttpRequest,HttpMessage,HttpOutputMessage,HttpRequest
public abstract class AbstractClientHttpRequest extends Object implements ClientHttpRequest
Abstract base forClientHttpRequestthat makes sure that headers and body are not written multiple times.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma
构造器概要
构造器 构造器 说明 AbstractClientHttpRequest()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected voidassertNotExecuted()Assert that this request has not been executed yet.ClientHttpResponseexecute()Execute this request, resulting in aClientHttpResponsethat can be read.protected abstract ClientHttpResponseexecuteInternal(HttpHeaders headers)Abstract template method that writes the given headers and content to the HTTP request.OutputStreamgetBody()Return the body of the message as an output stream.protected abstract OutputStreamgetBodyInternal(HttpHeaders headers)Abstract template method that returns the body.HttpHeadersgetHeaders()Return the headers of this message.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.http.HttpRequest
getMethod, getMethodValue, getURI
构造器详细资料
AbstractClientHttpRequest
public AbstractClientHttpRequest()
方法详细资料
getHeaders
public final HttpHeaders getHeaders()
从接口复制的说明:HttpMessageReturn the headers of this message.- 指定者:
getHeaders在接口中HttpMessage- 返回:
- a corresponding HttpHeaders object (never
null)
getBody
public final OutputStream getBody() throws IOException
从接口复制的说明:HttpOutputMessageReturn the body of the message as an output stream.- 指定者:
getBody在接口中HttpOutputMessage- 返回:
- the output stream body (never
null) - 抛出:
IOException- in case of I/O errors
execute
public final ClientHttpResponse execute() throws IOException
从接口复制的说明:ClientHttpRequestExecute this request, resulting in aClientHttpResponsethat can be read.- 指定者:
execute在接口中ClientHttpRequest- 返回:
- the response result of the execution
- 抛出:
IOException- in case of I/O errors
assertNotExecuted
protected void assertNotExecuted()
Assert that this request has not been executed yet.- 抛出:
IllegalStateException- if this request has been executed
getBodyInternal
protected abstract OutputStream getBodyInternal(HttpHeaders headers) throws IOException
Abstract template method that returns the body.- 参数:
headers- the HTTP headers- 返回:
- the body output stream
- 抛出:
IOException
executeInternal
protected abstract ClientHttpResponse executeInternal(HttpHeaders headers) throws IOException
Abstract template method that writes the given headers and content to the HTTP request.- 参数:
headers- the HTTP headers- 返回:
- the response object for the executed request
- 抛出:
IOException