I - Content type of request sent over this handler.O - Content type of response received over this handler.public static interface RedirectOperator.RedirectHandler<I,O>
requiresRedirect(RedirectionContext, HttpClientResponse) is
called to know whether the response requires a further redirection.validate(RedirectionContext, HttpClientResponse).
The reason for this not included in the previous call is that we want to differentiate between a response not
requiring redirects vs a response requiring redirects but not being performed because of limits like max redirects
allowed, redirect loops etc..doRedirect(RedirectionContext, HttpClientRequest, HttpClient.HttpClientConfig) will be called.| Modifier and Type | Interface and Description |
|---|---|
static class |
RedirectOperator.RedirectHandler.RedirectionContext |
| Modifier and Type | Method and Description |
|---|---|
rx.Observable<HttpClientResponse<O>> |
doRedirect(RedirectOperator.RedirectHandler.RedirectionContext context,
HttpClientRequest<I> originalRequest,
HttpClient.HttpClientConfig config)
Performs the redirect operation.
|
boolean |
requiresRedirect(RedirectOperator.RedirectHandler.RedirectionContext context,
HttpClientResponse<O> response)
Asserts whether the passed
response requires a redirect. |
void |
validate(RedirectOperator.RedirectHandler.RedirectionContext context,
HttpClientResponse<O> redirectResponse)
This is invoked if a particular response requires a redirect as evaluated by
requiresRedirect(RedirectionContext, HttpClientResponse). |
rx.Observable<HttpClientResponse<O>> doRedirect(RedirectOperator.RedirectHandler.RedirectionContext context, HttpClientRequest<I> originalRequest, HttpClient.HttpClientConfig config)
RedirectOperator.RedirectHandler.RedirectionContext.newLocation(String)
with the new redirect location.context - Redirection context.originalRequest - Original request that started this response processing.config - Client config to use while making the redirect request.boolean requiresRedirect(RedirectOperator.RedirectHandler.RedirectionContext context, HttpClientResponse<O> response)
response requires a redirect. If this returns true then
doRedirect(RedirectionContext, HttpClientRequest, HttpClient.HttpClientConfig)
will be called for this response if and only if the redirect is valid specified by
validate(RedirectionContext, HttpClientResponse)context - Redirection context.response - The response to be evaluated for redirects.true if the response needs redirection, else falsevoid validate(RedirectOperator.RedirectHandler.RedirectionContext context, HttpClientResponse<O> redirectResponse)
requiresRedirect(RedirectionContext, HttpClientResponse). If this returns
false the redirect is not performed, instead an error is propagated.
This should throw an exception if the redirect is not valid. eg: If the
max redirects limit is 3 and the redirects till now are 2, then this method should thrown an exception.context - The redirection context.redirectResponse - The response to be evaluated for redirects.HttpRedirectException - if the redirect is not valid.