public class HttpContext<T> extends Object
| Modifier and Type | Method and Description |
|---|---|
Object |
body() |
HttpClientRequest |
clientRequest() |
HttpClientResponse |
clientResponse() |
String |
contentType() |
void |
dispatchResponse(HttpResponse<T> response)
Dispatch the HTTP response, this executes the
ClientPhase.DISPATCH_RESPONSE phase:
Create the HttpResponse
Traverse the interceptor chain
Deliver the response to the response handler
|
boolean |
fail(Throwable cause)
Fail the current HTTP context, this executes the
ClientPhase.FAILURE phase:
Traverse the interceptor chain
Deliver the failure to the response handler
|
Throwable |
failure() |
void |
followRedirect()
Follow the redirect, this executes the
ClientPhase.FOLLOW_REDIRECT phase:
Traverse the interceptor chain
Send the redirect request
|
<T> T |
get(String key) |
List<String> |
getRedirectedLocations() |
void |
next()
Call the next interceptor in the chain.
|
ClientPhase |
phase() |
void |
prepareRequest(HttpRequest<T> request,
String contentType,
Object body)
Prepare the HTTP request, this executes the
ClientPhase.PREPARE_REQUEST phase:
Traverse the interceptor chain
Execute the ClientPhase.SEND_REQUEST phase
|
void |
receiveResponse(HttpClientResponse clientResponse)
Receive the HTTP response, this executes the
ClientPhase.RECEIVE_RESPONSE phase:
Traverse the interceptor chain
Execute the ClientPhase.DISPATCH_RESPONSE phase
|
int |
redirects() |
HttpContext<T> |
redirects(int redirects)
Set the number of followed redirects.
|
HttpRequest<T> |
request() |
HttpResponse<T> |
response() |
HttpContext<T> |
response(HttpResponse<T> response) |
void |
sendRequest(HttpClientRequest clientRequest)
Send the HTTP request, this executes the
ClientPhase.SEND_REQUEST phase:
Create the HttpClientRequest
Traverse the interceptor chain
Send the actual request
|
HttpContext<T> |
set(String key,
Object value) |
public HttpClientRequest clientRequest()
ClientPhase.SEND_REQUEST and afterpublic HttpClientResponse clientResponse()
ClientPhase.RECEIVE_RESPONSE and afterpublic ClientPhase phase()
public HttpRequest<T> request()
public HttpResponse<T> response()
ClientPhase.DISPATCH_RESPONSEpublic HttpContext<T> response(HttpResponse<T> response)
public int redirects()
0 during the prepare phasepublic HttpContext<T> redirects(int redirects)
redirects - the new valuepublic String contentType()
public Object body()
public Throwable failure()
ClientPhase.FAILUREpublic void prepareRequest(HttpRequest<T> request, String contentType, Object body)
ClientPhase.PREPARE_REQUEST phase:
ClientPhase.SEND_REQUEST phasepublic void sendRequest(HttpClientRequest clientRequest)
ClientPhase.SEND_REQUEST phase:
HttpClientRequestpublic void followRedirect()
ClientPhase.FOLLOW_REDIRECT phase:
public void receiveResponse(HttpClientResponse clientResponse)
ClientPhase.RECEIVE_RESPONSE phase:
ClientPhase.DISPATCH_RESPONSE phasepublic void dispatchResponse(HttpResponse<T> response)
ClientPhase.DISPATCH_RESPONSE phase:
HttpResponsepublic boolean fail(Throwable cause)
ClientPhase.FAILURE phase:
cause - the failure causetrue if the failure can be dispatchedpublic void next()
public <T> T get(String key)
public HttpContext<T> set(String key, Object value)
Copyright © 2020. All rights reserved.