Hi
I have an isssue I have problems resolving. On a jsp application I have a folder /store/* where users/administrators may upload content (in this case mostly e-learning courses, but it could basically be anything). To be able to control access I want to add a security servlet
<servlet-mapping>
<servlet-name>SecurityServlet</servlet-name>
<url-pattern>/store/*</url-pattern>
</servlet-mapping>
Looking something like
public class SecurityServlet extends HttpServlet
{
public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (!user is logged in and have valid access rights)
res.sendRedirect("someErrorPage.jsp");
else if (page is a jsp-page)
res.sendRedirect("someErrorPage.jsp"); //mayor security issue otherwise
else
let the user get the requested content
}
}
The problem is writing the else clause. If I do nothing I only get a blank page in the browser. If I redirect to the url of the request I get an infinite loop. So what are my other options?