- java.lang.Object
-
- jakarta.security.jacc.URLPattern
-
- jakarta.security.jacc.URLPatternSpec
-
- All Implemented Interfaces:
java.lang.Comparable<URLPattern>
class URLPatternSpec extends URLPattern
This class extends the URLPattern class and is used to represent URLPatternSpec objects. URLPatternSpec objects occur within WebResourcePermission and WebUserDataPermission objects.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
canonicalSpec
private static java.lang.String
EMPTY_STRING
private int
hashCodeValue
private URLPattern[]
urlPatternArray
private java.lang.String
urlPatternList
-
Fields inherited from class jakarta.security.jacc.URLPattern
PT_DEFAULT, PT_EXACT, PT_EXTENSION, PT_PREFIX
-
-
Constructor Summary
Constructors Constructor Description URLPatternSpec(java.lang.String urlPatternSpec)
Creates a new URLPatternSpec that identifies the web resources to which a WebResourcePermission or WebUserDataPermission applies.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
private static java.lang.String
getFirstPattern(java.lang.String urlPatternSpec)
java.lang.String
getURLPattern()
This method returns a String containing the first URLPattern in this URLPatternSpec.int
hashCode()
Returns the hash code value for this URLPatternSpec properties of the returned hash code must be as follows:boolean
implies(URLPatternSpec that)
Determines if the argument URLPatternSpec is "implied by" this URLPatternSpec.private void
setURLPatternArray()
java.lang.String
toString()
-
Methods inherited from class jakarta.security.jacc.URLPattern
compareTo, getPatternDepth, implies, patternType
-
-
-
-
Field Detail
-
EMPTY_STRING
private static java.lang.String EMPTY_STRING
-
hashCodeValue
private transient int hashCodeValue
-
canonicalSpec
private java.lang.String canonicalSpec
-
urlPatternList
private final java.lang.String urlPatternList
-
urlPatternArray
private URLPattern[] urlPatternArray
-
-
Constructor Detail
-
URLPatternSpec
public URLPatternSpec(java.lang.String urlPatternSpec)
Creates a new URLPatternSpec that identifies the web resources to which a WebResourcePermission or WebUserDataPermission applies.The syntax of the name parameter is as follows:
URLPatternList ::= URLPattern | URLPatternList colon URLPattern URLPatternSpec ::= URLPattern | URLPattern colon URLPatternList name ::= URLPatternSpec
The first URLPattern in a URLPatternSpec may be any of the pattern types, exact, path-prefix, extension, or default as defined in the Jakarta Servlet Specification). When a URLPatternSpec includes a URLPatternList, the patterns of the URLPatternList identify the resources to which the permission does NOT apply and depend on the pattern type and value of the first pattern as follows:- No pattern may exist in the URLPatternList that matches the first pattern.
- If the first pattern is a path-prefix pattern, only exact patterns matched by the first pattern and path-prefix patterns matched by, but different from, the first pattern may occur in the URLPatternList.
- If the first pattern is an extension pattern, only exact patterns that are matched by the first pattern and path-prefix patterns may occur in the URLPatternList.
- If the first pattern is the default pattern, "/", any pattern except the default pattern may occur in the URLPatternList.
- If the first pattern is an exact pattern a URLPatternList must not be present in the URLPatternSpec.
- Parameters:
urlPatternSpec
- a String containing a URLPatternSpec that identifies the application specific web resources to which the permission pertains. All URLPatterns in the URLPatternSpec are relative to the context path of the deployed web application module, and the same URLPattern must not occur more than once in a URLPatternSpec.
-
-
Method Detail
-
getURLPattern
public java.lang.String getURLPattern()
This method returns a String containing the first URLPattern in this URLPatternSpec.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classURLPattern
-
hashCode
public int hashCode()
Returns the hash code value for this URLPatternSpec properties of the returned hash code must be as follows:- During the lifetime of a Java application, the hashCode method must return the same integer value, every time it is called on a URLPatternSpec object. The value returned by hashCode for a particular URlPatternSpec need not remain consistent from one execution of an application to another.
- If two URLPatternSpec objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result (within an application).
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the integer hash code value for this object.
-
implies
public boolean implies(URLPatternSpec that)
Determines if the argument URLPatternSpec is "implied by" this URLPatternSpec.For this to be the case, all of the following must be true:
- The argument is an
instanceof
URLPatternSpec
, and - The first Pattern in the argument
URLPatternSpec
is matched by the firstURLPattern
of thisURLPatternSpec
. - The first Pattern in the argument
URLPatternSpec
is NOT matched by any URLPattern in theURLPatternList
of this URLPatternSpec. - If the first Pattern in the argument
URLPatternSpec
matches the first Pattern in thisURLPatternSpec
, then every URLPattern in the URLPatternList of thisURLPatternSpec
is matched by aURLPattern
in theURLPatternList
of the argumentURLPatternSpec
.
- their pattern values are String equivalent, or
- this pattern is the path-prefix pattern "/*", or
- this pattern is a path-prefix pattern (that is, it starts with "/" and ends with "/*") and the argument pattern starts with the substring of this pattern, minus its last 2 characters, and the next character of the argument pattern, if there is one, is "/", or
- this pattern is an extension pattern (that is, it starts with "*.") and the argument pattern ends with this pattern, or
- the reference pattern is the special default pattern, "/", which matches all argument patterns.
All of the comparisons described above are case sensitive.
- Parameters:
that
- "this" URLPatternSpec is checked to see if it implies the argument URLPatternSpec.- Returns:
- true if the specified URLPatternSpec is implied by this URLPatternSpec, false if not.
- The argument is an
-
toString
public java.lang.String toString()
- Overrides:
toString
in classURLPattern
-
getFirstPattern
private static java.lang.String getFirstPattern(java.lang.String urlPatternSpec)
-
setURLPatternArray
private void setURLPatternArray()
-
-