org.apache.hc.client5.http.impl

## Class DefaultRedirectStrategy

- java.lang.Object
- - org.apache.hc.client5.http.impl.DefaultRedirectStrategy

- All Implemented Interfaces:
    RedirectStrategy

      @Contract(threading=STATELESS)
      public class DefaultRedirectStrategy
      extends Object
      implements RedirectStrategy

  Default implementation of `RedirectStrategy`.
  Since:
    4.1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DefaultRedirectStrategy` | `INSTANCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultRedirectStrategy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected URI` | `createLocationURI(String location)`
    `URI` | `getLocationURI(HttpRequest request, HttpResponse response, HttpContext context)`
    `boolean` | `isRedirected(HttpRequest request, HttpResponse response, HttpContext context)` Determines if a request should be redirected to a new location given the response from the target server.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTANCE

          public static final DefaultRedirectStrategy INSTANCE

  - ### Constructor Detail

    - #### DefaultRedirectStrategy

          public DefaultRedirectStrategy()

  - ### Method Detail

    - #### isRedirected

          public boolean isRedirected(HttpRequest request,
                                      HttpResponse response,
                                      HttpContext context)
                               throws ProtocolException

      Description copied from interface: `RedirectStrategy`
      Determines if a request should be redirected to a new location given the response from the target server.
      Specified by:
        `isRedirected` in interface `RedirectStrategy`
      Parameters:
        `request` - the executed request
        `response` - the response received from the target server
        `context` - the context for the request execution
      Returns:
        `true` if the request should be redirected, `false` otherwise
      Throws:
        `ProtocolException`

    - #### getLocationURI

          public URI getLocationURI(HttpRequest request,
                                    HttpResponse response,
                                    HttpContext context)
                             throws HttpException

      Specified by:
        `getLocationURI` in interface `RedirectStrategy`
      Throws:
        `HttpException`

    - #### createLocationURI

          protected URI createLocationURI(String location)
                                   throws ProtocolException

      Throws:
        `ProtocolException`
      Since:
        4.1

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.