/** Servlet that simply redirects users to the * Web application home page. Registered with the * default servlet URL to prevent clients from * using http://host/webAppPrefix/servlet/ServletName * to bypass filters or security settings that * are associated with custom URLs. */
public class RedirectorServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.sendRedirect(request.getContextPath()); }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {