Package javax.servlet

Class ServletSecurityElement

java.lang.Object
javax.servlet.HttpConstraintElement
javax.servlet.ServletSecurityElement

public class ServletSecurityElement extends HttpConstraintElement
Java Class represntation of a ServletSecurity annotation value.
Since:
Servlet 3.0
  • Field Details

  • Constructor Details

    • ServletSecurityElement

      public ServletSecurityElement()
      Constructs an instance using the default HttpConstraintElement value as the default Constraint element and with no HTTP Method specific constraint elements.
    • ServletSecurityElement

      public ServletSecurityElement(HttpConstraintElement constraint)
      Constructs an instance with a default Constraint element and with no HTTP Method specific constraint elements.
      Parameters:
      constraint - the HttpConstraintElement to be applied to all HTTP methods other than those represented in the methodConstraints
    • ServletSecurityElement

      public ServletSecurityElement(Collection<HttpMethodConstraintElement> methodConstraints)
      Constructs an instance using the default HttpConstraintElement value as the default Constraint element and with a collection of HTTP Method specific constraint elements.
      Parameters:
      methodConstraints - the collection of HTTP method specific constraint elements
      Throws:
      IllegalArgumentException - if duplicate method names are detected
    • ServletSecurityElement

      public ServletSecurityElement(HttpConstraintElement constraint, Collection<HttpMethodConstraintElement> methodConstraints)
      Constructs an instance with a default Constraint element and with a collection of HTTP Method specific constraint elements.
      Parameters:
      constraint - the HttpConstraintElement to be applied to all HTTP methods other than those represented in the methodConstraints
      methodConstraints - the collection of HTTP method specific constraint elements.
      Throws:
      IllegalArgumentException - if duplicate method names are detected
    • ServletSecurityElement

      public ServletSecurityElement(ServletSecurity annotation)
      Constructs an instance from a ServletSecurity annotation value.
      Parameters:
      annotation - the annotation value
      Throws:
      IllegalArgumentException - if duplicate method names are detected
  • Method Details

    • getHttpMethodConstraints

      public Collection<HttpMethodConstraintElement> getHttpMethodConstraints()
      Gets the (possibly empty) collection of HTTP Method specific constraint elements.
      Returns:
      the (possibly empty) collection of HttpMethodConstraintElement objects
    • getMethodNames

      public Collection<String> getMethodNames()
      Gets the set of HTTP methid names named by the HttpMethodConstraints.
      Returns:
      the set of String method names
    • checkMethodNames

      private Collection<String> checkMethodNames(Collection<HttpMethodConstraintElement> methodConstraints)
      Checks for duplicate method names in methodConstraints.
      Parameters:
      methodConstraints -
      Throws:
      IllegalArgumentException - if duplicate method names are detected