The login.jsp contains the login form (ibm example):
Form Login
the error.jsp contains an error message (ibm example):
A Form login authentication failure occurred
Authentication may fail for one of many reasons. Some possibilities include:
- The user-id or password may be entered incorrectly; either misspelled or thewrong case was used.
- The user-id or password does not exist, has expired, or has been disabled.
So whats going on (example):
1. User is trying to access http://example.com/app/index.html
2. User get redirected to http://example.com/app/login.jsp
2.1 WAS creates a cookie called WASReqURL which contains the whished path (Value: http[s]://[:Port]/app/index.jsp)
3. User types in user-id and passwort and submits the login credentials
3.1 WAS reads the WASReqURL-Cookie and redirects the the requested path (http://example.com/app/index.html).
3.2 If the credentials are wrong WAS redirects the user to http://example.com/app/error.jsp
It is possible to edit the WASReqURL-Cookie to change the redirect path after a successful login.
Steps:
1. Read cookie Value:
1.
String url ="";
2.
String text = "";
3.
String newurl = "";
4.
//Get all cookies
5.
Cookie[] cookies = request.getCookies();
for (int index=0; index <= cookies.length; index++) {
6.
String cookieName = cookies[index].getName();
7.
if ("WASReqURL".equals(cookieName)) {
8.
//If WASReqURL-Cookie is found, get the value and cancel for-loop urlwithoutlogging = cookies[index].getValue();
9.
break;
10.
}
11.
}
2. Set a new WASReqURL-Cookie
1.
Cookie wasrequrlcookie = new Cookie("WASReqURL",newurl));
2.
response.addCookie(wasrequrlcookie);
Links: