Class SecurityCollection

java.lang.Object
org.apache.tomcat.util.descriptor.web.XmlEncodingBase
org.apache.tomcat.util.descriptor.web.SecurityCollection
All Implemented Interfaces:
Serializable

public class SecurityCollection extends XmlEncodingBase implements Serializable
Representation of a web resource collection for a web application's security constraint, as represented in a <web-resource-collection> element in the deployment descriptor.

WARNING: It is assumed that instances of this class will be created and modified only within the context of a single thread, before the instance is made visible to the remainder of the application. After that, only read access is expected. Therefore, none of the read and write access within this class is synchronized.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a new security collection instance with default values.
    SecurityCollection(String name, String description)
    Construct a new security collection instance with specified values.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addMethod(String method)
    Add an HTTP request method to be explicitly part of this web resource collection.
    void
    Add an HTTP request method to the methods explicitly excluded from this web resource collection.
    void
    addPattern(String pattern)
    Add a URL pattern to be part of this web resource collection.
    void
    Add a URL pattern (already decoded) to be part of this web resource collection.
    boolean
    Check if the collection applies to the specified method.
    Get the HTTP request methods that are part of this web resource collection.
    Get the HTTP request methods explicitly excluded from this web resource collection.
    boolean
    Is the specified pattern part of this web resource collection?
    Get the URL patterns that are part of this web resource collection.
    Get the description of this web resource collection.
    Get the name of this web resource collection.
    boolean
    Determine if this constraint was defined in a deployment descriptor.
    void
    Remove the specified HTTP request method from those that are part of this web resource collection.
    void
    Remove the specified HTTP request method from those that are explicitly excluded from this web resource collection.
    void
    Remove the specified URL pattern from those that are part of this web resource collection.
    void
    setDescription(String description)
    Set the description of this web resource collection.
    void
    setFromDescriptor(boolean isFromDescriptor)
    Set if this constraint was defined in a deployment descriptor.
    void
    Set the name of this web resource collection
    Return a String representation of this security collection.

    Methods inherited from class XmlEncodingBase

    getCharset, setCharset

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SecurityCollection

      public SecurityCollection()
      Construct a new security collection instance with default values.
    • SecurityCollection

      public SecurityCollection(String name, String description)
      Construct a new security collection instance with specified values.
      Parameters:
      name - Name of this security collection
      description - Description of this security collection
  • Method Details

    • getDescription

      public String getDescription()
      Get the description of this web resource collection.
      Returns:
      the description of this web resource collection
    • setDescription

      public void setDescription(String description)
      Set the description of this web resource collection.
      Parameters:
      description - The new description
    • getName

      public String getName()
      Get the name of this web resource collection.
      Returns:
      the name of this web resource collection
    • setName

      public void setName(String name)
      Set the name of this web resource collection
      Parameters:
      name - The new name
    • isFromDescriptor

      public boolean isFromDescriptor()
      Determine if this constraint was defined in a deployment descriptor.
      Returns:
      true if this constraint was defined in a deployment descriptor
    • setFromDescriptor

      public void setFromDescriptor(boolean isFromDescriptor)
      Set if this constraint was defined in a deployment descriptor.
      Parameters:
      isFromDescriptor - true was declared in a descriptor
    • addMethod

      public void addMethod(String method)
      Add an HTTP request method to be explicitly part of this web resource collection.
      Parameters:
      method - The method
    • addOmittedMethod

      public void addOmittedMethod(String method)
      Add an HTTP request method to the methods explicitly excluded from this web resource collection.
      Parameters:
      method - The method
    • addPattern

      public void addPattern(String pattern)
      Add a URL pattern to be part of this web resource collection.
      Parameters:
      pattern - The pattern
    • addPatternDecoded

      public void addPatternDecoded(String pattern)
      Add a URL pattern (already decoded) to be part of this web resource collection.
      Parameters:
      pattern - The decoded pattern
    • findMethod

      public boolean findMethod(String method)
      Check if the collection applies to the specified method.
      Parameters:
      method - Request method to check
      Returns:
      true if the specified HTTP request method is part of this web resource collection.
    • findMethods

      public String[] findMethods()
      Get the HTTP request methods that are part of this web resource collection.
      Returns:
      the array of HTTP request methods, or a zero-length array if no methods have been explicitly included
    • findOmittedMethods

      public String[] findOmittedMethods()
      Get the HTTP request methods explicitly excluded from this web resource collection.
      Returns:
      the array of excluded HTTP request methods, or a zero-length array if no methods are excluded
    • findPattern

      public boolean findPattern(String pattern)
      Is the specified pattern part of this web resource collection?
      Parameters:
      pattern - Pattern to be compared
      Returns:
      true if the pattern is part of the collection
    • findPatterns

      public String[] findPatterns()
      Get the URL patterns that are part of this web resource collection.
      Returns:
      the array of URL patterns, or a zero-length array if none have been specified
    • removeMethod

      public void removeMethod(String method)
      Remove the specified HTTP request method from those that are part of this web resource collection.
      Parameters:
      method - Request method to be removed
    • removeOmittedMethod

      public void removeOmittedMethod(String method)
      Remove the specified HTTP request method from those that are explicitly excluded from this web resource collection.
      Parameters:
      method - Request method to be removed
    • removePattern

      public void removePattern(String pattern)
      Remove the specified URL pattern from those that are part of this web resource collection.
      Parameters:
      pattern - Pattern to be removed
    • toString

      public String toString()
      Return a String representation of this security collection.
      Overrides:
      toString in class Object