code: public void doIndex(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
          if (!common.checkGet(request, response)) return;
  
          // If there's a user logged in, send them to "/home".
          User user = common.getLoggedInUser(request);
          if (user != null) {
              response.sendRedirect("/home");
              return;
          }
  
          FormProtection fp = FormProtection.start(response);
  
          response.setContentType("text/html");
          response.setCharacterEncoding("utf-8");
          PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8"));
  
          out.println("<html>");
          out.println("<head><title>Home - Web File Browser</title></head>");
          out.println("<body>");
          fp.insertAntiRedressHtml(out);
  
          // Login form.
          out.println("<h2>Log in</h2>");
          out.println("<form action='/login' method='POST'>");
          fp.insertAntiCsrfFormField(out);
          out.println("<p>Username: <input name='username' type='text' /> (pick whatever you want)</p>");
          out.println("<p>No password needed for this tiny example.</p>");
          out.println("<input type='submit' value='Login' />");
          out.println("</form>");
  
          out.println("</body>");
          out.println("</html>");
          out.flush();
      }
docs: redirected to "/home".