Helper: ResponseHelper
Uses
A typical use for this helper is within a callback JSP fragment to test if the response was successful, or to test if the user needs to authenticate before they are allowed to see the page contents.
Methods
ResponseHelper.sendOkResponse(response)
Parameters: javax.servlet.http.HttpServletResponse
Returns:
Sends an HTTP OK status code (200) back as a response code indicating the request was handled successfully.
Example
if ("200".equals(request.getParameter("status"))) { ResponseHelper.sendOkResponse(response); }
ResponseHelper.sendRedirectResponse(response, location)
Parameters: javax.servlet.http.HttpServletResponse, String
Returns:
Sends an HTTP redirection/temporarily moved status code (302) back as a response code indicating the request was redirected to another location. The new location should be handled automatically by the browser, but can be obtained as the location header of the response.
ResponseHelper.sendUnauthorizedResponse(response)
Parameters: javax.servlet.http.HttpServletResponse
Returns:
Sends an HTTP unauthorized status code (401) back as a response code indicating the user must authenticate before accessing the intended URL.
Example
if ("401".equals(request.getParameter("status")) || context == null) { ResponseHelper.sendUnauthorizedResponse(response); }