I have a JEE application that uses JQuery / DataTabes, etc
I have an Authenticate routine that checks if the signed on user has permission to run the program. This works up to the point where it should forward to my 'Unauthorized' page. Instead it just returns to the calling jsp as if the user passed authorization.
Here is my jsp code:
<script type="text/javascript">
$.ajax({
url: "${pageContext.request.contextPath}/Authenticate",
type: "get",
async: "false",
cache: "false"
});
</script>
and here is my servlet code:
if (rsAuth.getInt(1) == 0) {
String unauthorizedPage = "/NotAuthorized.html";
RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher(unauthorizedPage);
dispatcher.forward(request, response);
}
The html file is in the root directory of the appplication (along with the index) I am running on Tomcat 8.
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/MemberTXN"/>
I tried without the "/" in front of the error file but got a runtime exception : IllegalArgumentException: PathNotAuthorized.html does not start with a "/" character.