ContextResource (Apache Tomcat 9.0.119 API Documentation)
Description: declaration: package: org.apache.tomcat.util.descriptor.web, class: ContextResource

# Class ContextResource

java.lang.Object
org.apache.tomcat.util.descriptor.web.ResourceBase
org.apache.tomcat.util.descriptor.web.ContextResource

All Implemented Interfaces:
  `Serializable, Injectable`

public class ContextResource extends ResourceBase
Representation of a resource reference for a web application, as represented in a `<resource-ref>` element in the deployment descriptor.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContextResource()`
  Default constructor for ContextResource.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `String`
  `getAuth()`
  Returns the authorization requirement for this resource.
  `String`
  `getCloseMethod()`
  Returns the close method name.
  `boolean`
  `getCloseMethodConfigured()`
  Returns whether the close method has been explicitly configured.
  `String`
  `getScope()`
  Returns the sharing scope of this resource factory.
  `boolean`
  `getSingleton()`
  Returns whether this resource is a singleton.
  `int`
  `hashCode()`
  `void`
  `setAuth(String auth)`
  Sets the authorization requirement for this resource.
  `void`
  `setCloseMethod(String closeMethod)`
  Sets the close method name.
  `void`
  `setScope(String scope)`
  Sets the sharing scope of this resource factory.
  `void`
  `setSingleton(boolean singleton)`
  Sets whether this resource is a singleton.
  `String`
  `toString()`
  Return a String representation of this object.

  ### Methods inherited from class ResourceBase

  `addInjectionTarget, getDescription, getInjectionTargets, getLookupName, getName, getNamingResources, getProperty, getType, listProperties, removeProperty, setDescription, setLookupName, setName, setNamingResources, setProperty, setType`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ContextResource

    public ContextResource()
    Default constructor for ContextResource.

- ## Method Details

  - ### getAuth

    public String getAuth()
    Returns the authorization requirement for this resource.
    Returns:
      the authorization type

  - ### setAuth

    public void setAuth(String auth)
    Sets the authorization requirement for this resource.
    Parameters:
      `auth` - the authorization type

  - ### getScope

    public String getScope()
    Returns the sharing scope of this resource factory.
    Returns:
      the sharing scope

  - ### setScope

    public void setScope(String scope)
    Sets the sharing scope of this resource factory.
    Parameters:
      `scope` - the sharing scope

  - ### getSingleton

    public boolean getSingleton()
    Returns whether this resource is a singleton.
    Returns:
      true if the resource is a singleton

  - ### setSingleton

    public void setSingleton(boolean singleton)
    Sets whether this resource is a singleton.
    Parameters:
      `singleton` - true if the resource is a singleton

  - ### getCloseMethod

    public String getCloseMethod()
    Returns the close method name.
    Returns:
      the close method name

  - ### setCloseMethod

    public void setCloseMethod(String closeMethod)
    Sets the close method name.
    Parameters:
      `closeMethod` - the close method name

  - ### getCloseMethodConfigured

    public boolean getCloseMethodConfigured()
    Returns whether the close method has been explicitly configured.
    Returns:
      true if the close method was configured

  - ### toString

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

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `ResourceBase`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `ResourceBase`