String url = (String)parameters.get(Parameters.REDIRECT_URL_PARAMETER);
if (url == null) {
url = request.getContextPath();
}
if (a instanceof AuthSuccessfull) {
AuthSuccessfull as = (AuthSuccessfull)a;
SecurityHelper.saveAuthentification(ServletHelper.getCurrentSession(), a);
Map params = new HashMap();
int index = url.indexOf("?p=");
if (index != -1) {
// There is paramemters
String pathParam = url.substring(index + 3);
url = url.substring(0, index);
// BUG FIX 844
// The pathParam has been UTF8 encoded we have to decode it
pathParam = URLDecoder.decode(pathParam, "UTF-8");
params.putAll(URLHelper.decodeParams(pathParam));
}
url = URLHelper.appendParameters(url, SecurityHelper.fillMapWithUAK(params, as.getKey()));
throw new URLRedirectException(url);
} else {
RequestDispatcher d = getServletContext().getRequestDispatcher("/login.jsp");
request.setAttribute("message", "Invalid authentication. Please try again.");
request.setAttribute(Parameters.REDIRECT_URL_PARAMETER, url);