summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java b/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java
index cb16b8f..ab3d3b9 100644
--- a/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java
+++ b/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java
@@ -164,11 +164,17 @@ public class MOAIDAuthenticationFilter implements Filter {
// CustomHttpServletRequest(httpServletRequest).toString());
session.setAttribute(STORED_REQUEST_URL_ID, requestURL);
}
+
+ String page = loginPage;
+
+ if (loginPage.startsWith("/") && !loginPage.startsWith("//"))
+ page = httpServletRequest.getContextPath() + loginPage;
+
if (loginPageForward) {
- RequestDispatcher dispatcher = request.getRequestDispatcher(loginPage);
+ RequestDispatcher dispatcher = request.getRequestDispatcher(page);
dispatcher.forward(httpServletRequest, httpServletResponse);
} else {
- httpServletResponse.sendRedirect(httpServletResponse.encodeRedirectURL(loginPage));
+ httpServletResponse.sendRedirect(httpServletResponse.encodeRedirectURL(page));
}
return;
}