I am trying to use a servlet for authorization like this:
There is a servlet called authservlet which checks to see if there is
a valid user object in the session state. Here is how it is used:
I have a directory called /secure with a bunch of .jsp files in it.
There is a mapping in web.xml:
<servlet-mapping>
<servlet-name>
authservlet
</servlet-name>
<url-pattern>
/secure/*
</url-pattern>
</servlet-mapping>
Every time someone tries to request a page like /secure/hello.jsp, the
request is instead handed to authservlet. That part is working fine.
authservlet gets the request and can decide what to do with it.
The problem is that I am trying to get authservlet to pass the request
back to the jsp by doing something like this:
RequestDispatcher rd =
request.getRequestDispatcher("/secure/hello.jsp");
rd.forward(request, response);
where in this case I have hard-coded in hello.jsp as the target, just
for testing (obviously I will replace this with something which looks
at what the real url is).
The problem is, when I then try to load /secure/hello.jsp, it looks
like the server goes into an infinite loop. It never returns the page
and I end up with a bunch of catalina processes running, which I have
to kill -9 to get rid of.
I'm sure I'm making some simple mistake here. Any sugestions?
Thanks