1 22 package org.jboss.test.security.servlets; 23 24 import java.io.IOException ; 25 import java.io.PrintWriter ; 26 import java.security.Principal ; 27 import javax.servlet.http.HttpServlet ; 28 import javax.servlet.http.HttpServletRequest ; 29 import javax.servlet.http.HttpServletResponse ; 30 import javax.servlet.ServletException ; 31 32 38 public class ConstraintsServlet extends HttpServlet 39 { 40 protected void doRequest(HttpServletRequest request, HttpServletResponse response) 41 throws ServletException , IOException 42 { 43 Principal caller = request.getUserPrincipal(); 44 PrintWriter pw = response.getWriter(); 45 pw.write("<html>\n"); 46 pw.write("<br>Saw UserPrincipal: "+caller); 47 pw.write("<br>PathInfo: "+request.getPathInfo()); 48 pw.write("</html>\n"); 49 } 50 51 protected void doPost(HttpServletRequest request, HttpServletResponse response) 52 throws ServletException , IOException 53 { 54 doRequest(request, response); 55 } 56 57 protected void doGet(HttpServletRequest request, HttpServletResponse response) 58 throws ServletException , IOException 59 { 60 doRequest(request, response); 61 } 62 } 63 | Popular Tags |