Class IgnitionRedirectStrategy

java.lang.Object
org.apache.hc.client5.http.impl.DefaultRedirectStrategy
com.inductiveautomation.ignition.common.http.IgnitionRedirectStrategy
All Implemented Interfaces:
org.apache.hc.client5.http.protocol.RedirectStrategy

public final class IgnitionRedirectStrategy extends org.apache.hc.client5.http.impl.DefaultRedirectStrategy
Redirect strategy applied to Ignition's HTTP clients.

This decides only whether a redirect is followed, and to what URI. Building the follow-up request, including any change of method, is the client's redirect interceptor's job.

GET and HEAD follow redirects normally, as does any method on a 303 See Other. Every other combination is refused: a 301, 302, 307 or 308 answering a POST, PUT or DELETE is returned to the caller rather than resent, because replaying a request that changes server state is the caller's decision to make.

Redirects that cross an origin are refused when the request carries an Authorization or Cookie header, so credentials are never forwarded to a host the caller did not address. The 3xx response is returned instead.

Install on a client with HttpClientBuilder#setRedirectStrategy(INSTANCE).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isRedirected(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context)
    Returns whether the response should be followed to its Location.

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

    createLocationURI, getLocationURI, isRedirectAllowed

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • 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) throws org.apache.hc.core5.http.ProtocolException
      Returns whether the response should be followed to its Location.
      Specified by:
      isRedirected in interface org.apache.hc.client5.http.protocol.RedirectStrategy
      Overrides:
      isRedirected in class org.apache.hc.client5.http.impl.DefaultRedirectStrategy
      Parameters:
      request - the request that produced the response
      response - the response to evaluate
      context - the active context
      Returns:
      whether the response should be followed to its Location
      Throws:
      org.apache.hc.core5.http.ProtocolException - if the response cannot be interpreted