Class SecuredRedirectHandler

All Implemented Interfaces:
Handler, HandlerContainer, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

public class SecuredRedirectHandler extends HandlerWrapper

SecuredRedirectHandler redirects from http to https.

SecuredRedirectHandler uses the information present in HttpConfiguration attempting to redirect to the HttpConfiguration.getSecureScheme() and HttpConfiguration.getSecurePort() for any request that ServletRequest.isSecure() is false.

  • Constructor Details

    • SecuredRedirectHandler

      public SecuredRedirectHandler()
      Uses moved temporarily code (302) as the redirect code.
    • SecuredRedirectHandler

      public SecuredRedirectHandler(int code)
      Use supplied code as the redirect code.
      Parameters:
      code - the redirect code to use in the response
      Throws:
      IllegalArgumentException - if parameter is an invalid redirect code
  • Method Details

    • handle

      public void handle(String target, Request baseRequest, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
      Description copied from interface: Handler
      Handle a request.
      Specified by:
      handle in interface Handler
      Overrides:
      handle in class HandlerWrapper
      Parameters:
      target - The target of the request - either a URI or a name.
      baseRequest - The original unwrapped request object.
      request - The request either as the Request object or a wrapper of that request. The HttpConnection.getCurrentConnection().getHttpChannel().getRequest() method can be used access the Request object if required.
      response - The response as the Response object or a wrapper of that request. The HttpConnection.getCurrentConnection().getHttpChannel().getResponse() method can be used access the Response object if required.
      Throws:
      IOException - if unable to handle the request or response processing
      jakarta.servlet.ServletException - if unable to handle the request or response due to underlying servlet issue