At the moment I am trying to make my own canonical links in Java web.
I got this in my web.xml
<servlet-mapping>
<servlet-name>ControllerServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
ControllerServlet will call a factory that will use the getPathInfo() to call the correct class to handle this. The method that will handle the requests looks like
public void handleRequest(HttpServletRequest request, HttpServletResponse response) {
try {
RequestDispatcher view = request.getRequestDispatcher("../Overview.jsp");
view.forward(request, response);
} catch (Exception ex) {
System.out.println("error");
}
}
Now when I want to visit my page I will surf to
http://localhost/firstfolder/overview
The pathinfo I get is /firstfolder/overview, this redirects correctly to /Overview.jsp but after that it keeps redirecting to /Overview.jsp and ultimately crash. Leaving the end user with an empty page. Any idea how I can stop this unlimited looping and just serve the page?