Package jakarta.servlet
Class ServletSecurityElement
java.lang.Object
jakarta.servlet.HttpConstraintElement
jakarta.servlet.ServletSecurityElement
Java Class representation of a
ServletSecurity
annotation value.- Since:
- Servlet 3.0
-
Constructor Summary
ConstructorDescriptionConstructs 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, Collection<HttpMethodConstraintElement> methodConstraints) Constructs an instance with a default Constraint element and with a collection of HTTP Method specific constraint elements.ServletSecurityElement
(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
Modifier and TypeMethodDescriptionGets the (possibly empty) collection of HTTP Method specific constraint elements.Gets the set of HTTP method names named by the HttpMethodConstraints.Methods inherited from class jakarta.servlet.HttpConstraintElement
getEmptyRoleSemantic, getRolesAllowed, getTransportGuarantee
-
Constructor Details
-
ServletSecurityElement
public ServletSecurityElement()Constructs an instance using the defaultHttpConstraintElement
value as the default Constraint element and with no HTTP Method specific constraint elements. -
ServletSecurityElement
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
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:
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 methodConstraintsmethodConstraints
- the collection of HTTP method specific constraint elements.- Throws:
IllegalArgumentException
- if duplicate method names are detected
-
ServletSecurityElement
Constructs an instance from aServletSecurity
annotation value.- Parameters:
annotation
- the annotation value- Throws:
IllegalArgumentException
- if duplicate method names are detected
-
-
Method Details
-
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
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
-