- if (hs == null || !((Boolean) hs.getAttribute("loggedin"))) {
- resp.setContentType("text/html");
- resp.getWriter().println("Access denied. Sending login form.");
- resp.getWriter()
- .println(
- "<form method='POST' action='/login'>"
- + "<input type='text' name='username'>"
- + "<input type='password' name='password'> <input type='submit' value='login'></form>");
+ if ((hs == null || !((Boolean) hs.getAttribute("loggedin")))
+ && !"/login".equals(req.getPathInfo())) {
+ System.out.println(req.getPathInfo());
+ resp.sendRedirect("/login");