Class RolePrintingServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.jboss.as.test.integration.security.common.servlets.RolePrintingServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

@WebServlet(urlPatterns="/printRoles") @ServletSecurity(@HttpConstraint(rolesAllowed="*")) public class RolePrintingServlet extends jakarta.servlet.http.HttpServlet
A RolePrintingServlet gets list of role names as (GET) request parameters and returns a comma separated sublist of such role names for which HttpServletRequest.isUserInRole(String) returns true. Don't forget to declare the tested roles in the web.xml file.
Author:
Josef Cacek
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
    Name of the HTTP request parameter which holds a role name.
    static final String
    The default servlet path (used in WebServlet annotation).

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
    Writes plain-text response with the comma-separated role names (subset of the names retrieved as GET parameters).

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, service

    Methods inherited from class jakarta.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PARAM_ROLE_NAME

      public static String PARAM_ROLE_NAME
      Name of the HTTP request parameter which holds a role name.
    • SERVLET_PATH

      public static final String SERVLET_PATH
      The default servlet path (used in WebServlet annotation).
      See Also:
  • Constructor Details

    • RolePrintingServlet

      public RolePrintingServlet()
  • Method Details

    • doGet

      protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      Writes plain-text response with the comma-separated role names (subset of the names retrieved as GET parameters).
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Parameters:
      req -
      resp -
      Throws:
      jakarta.servlet.ServletException
      IOException
      See Also:
      • HttpServlet.doGet(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)