Class HttpRedirectResponse


public class HttpRedirectResponse extends HttpStringResponse
Response to redirect the client to another location.
Author:
Dr Michael Gardiner
  • Constructor Details

    • HttpRedirectResponse

      public HttpRedirectResponse(String location)
      Creates a redirect response for sending a client to another location.
      Parameters:
      location - where to redirect the user to.
    • HttpRedirectResponse

      public HttpRedirectResponse(int code, String location)
      Creates a redirect response for sending a client to another location with a custom status code.
      Parameters:
      code - HTTP status code (e.g. 301, 302, 307).
      location - where to redirect the user to.
  • Method Details

    • createPage

      public static String createPage(String location)
      Generates a basic HTML page for the redirection.
      Parameters:
      location - the destination URL
      Returns:
      a string containing HTML to redirect the user