public class LoginRedirectServlet
extends javax.servlet.http.HttpServlet
HTTP 405 Method Not Allowed response when the desired resource is a static one, such as a GWT host page.
This servlet works around the issue by sending an HTTP redirect only if the request comes from an authenticated user to a URL of your choice. The end result is that your user will see the real resource's URL in their browser's location bar after login. In addition, this servlet copies all request parameters that were submitted along with the login form (except j_username and j_password) to the redirect URL.
To set this servlet up, configure your web application as follows:
display-after-login set to the context-relative URI
of the page you want the user to land on after a successful login. (for example, /host_page.html)
/login.
FORM
/login).
| Modifier and Type | Field and Description |
|---|---|
static String |
DISPLAY_AFTER_LOGIN_INIT_PARAM |
static String |
DISPLAY_WHEN_NOT_AUTH_INIT_PARAM |
| Constructor and Description |
|---|
LoginRedirectServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
void |
init(javax.servlet.ServletConfig config) |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, servicepublic static final String DISPLAY_AFTER_LOGIN_INIT_PARAM
public static final String DISPLAY_WHEN_NOT_AUTH_INIT_PARAM
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletjavax.servlet.ServletExceptionprotected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doGet in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doPost in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionCopyright © 2012–2019 JBoss by Red Hat. All rights reserved.