@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String appBase = ServletTestUtils.getUrlBase(req); String actionUrl = appBase + "/input-portal/secured/post"; if (req.getRequestURI().endsWith("insecure")) { if (System.getProperty("insecure.user.principal.unsupported") == null) Assert.assertNotNull(req.getUserPrincipal()); resp.setContentType("text/html"); PrintWriter pw = resp.getWriter(); pw.printf("<html><head><title>Input Servlet</title></head><body>%s\n", "Insecure Page"); if (req.getUserPrincipal() != null) pw.printf("UserPrincipal: " + req.getUserPrincipal().getName()); pw.print("</body></html>"); pw.flush(); return; } resp.setContentType("text/html"); PrintWriter pw = resp.getWriter(); pw.printf("<html><head><title>%s</title></head><body>", "Input Page"); pw.printf("<form action=\"%s\" method=\"POST\">", actionUrl); pw.println("<input id=\"parameter\" type=\"text\" name=\"parameter\">"); pw.println("<input name=\"submit\" type=\"submit\" value=\"Submit\"></form>"); pw.print("</body></html>"); pw.flush(); }