org.apache.hc.client5.http.impl

## Class LaxRedirectStrategy

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

All Implemented Interfaces:
  RedirectStrategy

    @Contract(threading=STATELESS)
    public class LaxRedirectStrategy
    extends DefaultRedirectStrategy

A lax implementation of the `RedirectStrategy` that automatically handles HTTP redirects for HEAD, GET, POST, and DELETE requests based on the response status code.

This strategy relaxes the HTTP specification restrictions on automatic redirection of POST requests, allowing redirects for these methods where the specification might otherwise prohibit them. This can be useful in scenarios where a server indicates a redirect for a POST request that the client should follow.

This class is thread-safe and stateless, suitable for use across multiple threads without additional synchronization.

Since:
  5.4

### Field Summary

Fields
`static LaxRedirectStrategy` `INSTANCE`

### Constructor Summary

Constructors
Constructor and Description
`LaxRedirectStrategy()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected boolean` `isRedirectable(String method)`
`boolean` `isRedirected(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context)` Determines if a request should be redirected to a new location given the response from the target server.

### Methods inherited from class org.apache.hc.client5.http.impl.DefaultRedirectStrategy

`createLocationURI, getLocationURI`

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

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

### Field Detail

#### INSTANCE

    public static final LaxRedirectStrategy INSTANCE

### Constructor Detail

#### LaxRedirectStrategy

    public LaxRedirectStrategy()

### Method Detail

#### isRedirected

    public boolean isRedirected(org.apache.hc.core5.http.HttpRequest request,
                                org.apache.hc.core5.http.HttpResponse response,
                                org.apache.hc.core5.http.protocol.HttpContext context)

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`
Overrides:
  `isRedirected` in class `DefaultRedirectStrategy`
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

#### isRedirectable

    protected boolean isRedirectable(String method)