Package jakarta.servlet
Class ServletSecurityElement
- java.lang.Object
-
- jakarta.servlet.HttpConstraintElement
-
- jakarta.servlet.ServletSecurityElement
-
public class ServletSecurityElement extends HttpConstraintElement
Java Class representation of aServletSecurity
annotation value.- Since:
- Servlet 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<HttpMethodConstraintElement>
methodConstraints
private java.util.Collection<java.lang.String>
methodNames
-
Constructor Summary
Constructors Constructor Description ServletSecurityElement()
Constructs an instance using the defaultHttpConstraintElement
value as the default Constraint element and with no HTTP Method specific constraint elements.ServletSecurityElement(ServletSecurity annotation)
Constructs an instance from aServletSecurity
annotation value.ServletSecurityElement(HttpConstraintElement constraint)
Constructs an instance with a default Constraint element and with no HTTP Method specific constraint elements.ServletSecurityElement(HttpConstraintElement constraint, java.util.Collection<HttpMethodConstraintElement> methodConstraints)
Constructs an instance with a default Constraint element and with a collection of HTTP Method specific constraint elements.ServletSecurityElement(java.util.Collection<HttpMethodConstraintElement> methodConstraints)
Constructs an instance using the defaultHttpConstraintElement
value as the default Constraint element and with a collection of HTTP Method specific constraint elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.Collection<java.lang.String>
checkMethodNames(java.util.Collection<HttpMethodConstraintElement> methodConstraints)
Checks for duplicate method names in methodConstraints.java.util.Collection<HttpMethodConstraintElement>
getHttpMethodConstraints()
Gets the (possibly empty) collection of HTTP Method specific constraint elements.java.util.Collection<java.lang.String>
getMethodNames()
Gets the set of HTTP method names named by the HttpMethodConstraints.-
Methods inherited from class jakarta.servlet.HttpConstraintElement
getEmptyRoleSemantic, getRolesAllowed, getTransportGuarantee
-
-
-
-
Field Detail
-
methodNames
private java.util.Collection<java.lang.String> methodNames
-
methodConstraints
private java.util.Collection<HttpMethodConstraintElement> methodConstraints
-
-
Constructor Detail
-
ServletSecurityElement
public ServletSecurityElement()
Constructs an instance using the defaultHttpConstraintElement
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(java.util.Collection<HttpMethodConstraintElement> methodConstraints)
Constructs an instance using the defaultHttpConstraintElement
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:
java.lang.IllegalArgumentException
- if duplicate method names are detected
-
ServletSecurityElement
public ServletSecurityElement(HttpConstraintElement constraint, java.util.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 methodConstraintsmethodConstraints
- the collection of HTTP method specific constraint elements.- Throws:
java.lang.IllegalArgumentException
- if duplicate method names are detected
-
ServletSecurityElement
public ServletSecurityElement(ServletSecurity annotation)
Constructs an instance from aServletSecurity
annotation value.- Parameters:
annotation
- the annotation value- Throws:
java.lang.IllegalArgumentException
- if duplicate method names are detected
-
-
Method Detail
-
getHttpMethodConstraints
public java.util.Collection<HttpMethodConstraintElement> getHttpMethodConstraints()
Gets the (possibly empty) collection of HTTP Method specific constraint elements.If permitted, any changes to the returned
Collection
must not affect thisServletSecurityElement
.- Returns:
- the (possibly empty) collection of HttpMethodConstraintElement objects
-
getMethodNames
public java.util.Collection<java.lang.String> getMethodNames()
Gets the set of HTTP method names named by the HttpMethodConstraints.If permitted, any changes to the returned
Collection
must not affect thisServletSecurityElement
.- Returns:
- the collection String method names
-
checkMethodNames
private java.util.Collection<java.lang.String> checkMethodNames(java.util.Collection<HttpMethodConstraintElement> methodConstraints)
Checks for duplicate method names in methodConstraints.- Parameters:
methodConstraints
-- Returns:
- Set of method names
- Throws:
java.lang.IllegalArgumentException
- if duplicate method names are detected
-
-