RemoteCIDRValve (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.catalina.valves, class: RemoteCIDRValve

# Class RemoteCIDRValve

java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.valves.ValveBase
org.apache.catalina.valves.RequestFilterValve
org.apache.catalina.valves.RemoteCIDRValve

All Implemented Interfaces:
  `MBeanRegistration, Contained, JmxEnabled, Lifecycle, Valve`

public final class RemoteCIDRValve extends RequestFilterValve
A valve that restricts access based on the remote client's IP address or CIDR block.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Lifecycle

  `Lifecycle.SingleUse`

- ## Field Summary

  ### Fields inherited from class RequestFilterValve

  `allowValid, allowValue, denyStatus, denyValid, denyValue`

  ### Fields inherited from class ValveBase

  `asyncSupported, container, containerLog, next, sm`

  ### Fields inherited from interface Lifecycle

  `AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RemoteCIDRValve()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAllow()`
  Return a string representation of the `NetMask` list in #allow.
  `String`
  `getDeny()`
  Return a string representation of the `NetMask` list in #deny.
  `protected Log`
  `getLog()`
  Returns the logger instance used by this valve.
  `void`
  `invoke(Request request, Response response)`
  Extract the desired request property, and pass it (along with the specified request and response objects) to the protected `process()` method to perform the actual filtering.
  `boolean`
  `isAllowed(String property)`
  Perform the test implemented by this Valve, matching against the specified request property value.
  `void`
  `setAllow(String input)`
  Fill the #allow list with the list of netmasks provided as an argument, if any.
  `void`
  `setDeny(String input)`
  Fill the #deny list with the list of netmasks provided as an argument, if any.

  ### Methods inherited from class RequestFilterValve

  `denyRequest, getAddConnectorPort, getDenyStatus, getInvalidAuthenticationWhenDeny, getUsePeerAddress, initInternal, isAllowValid, isDenyValid, process, setAddConnectorPort, setDenyStatus, setInvalidAuthenticationWhenDeny, setUsePeerAddress, startInternal`

  ### Methods inherited from class ValveBase

  `backgroundProcess, getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, isAsyncSupported, setAsyncSupported, setContainer, setNext, stopInternal, toString`

  ### Methods inherited from class LifecycleMBeanBase

  `destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister`

  ### Methods inherited from class LifecycleBase

  `addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### RemoteCIDRValve

    public RemoteCIDRValve()
    Default constructor.

- ## Method Details

  - ### getAllow

    public String getAllow()
    Return a string representation of the `NetMask` list in #allow.
    Overrides:
      `getAllow` in class `RequestFilterValve`
    Returns:
      the #allow list as a string, without the leading '[' and trailing ']'

  - ### setAllow

    public void setAllow(String input)
    Fill the #allow list with the list of netmasks provided as an argument, if any. Calls #fillFromInput.
    Overrides:
      `setAllow` in class `RequestFilterValve`
    Parameters:
      `input` - The list of netmasks, as a comma separated string
    Throws:
      `IllegalArgumentException` - One or more netmasks are invalid

  - ### getDeny

    public String getDeny()
    Return a string representation of the `NetMask` list in #deny.
    Overrides:
      `getDeny` in class `RequestFilterValve`
    Returns:
      the #deny list as a string, without the leading '[' and trailing ']'

  - ### setDeny

    public void setDeny(String input)
    Fill the #deny list with the list of netmasks provided as an argument, if any. Calls #fillFromInput.
    Overrides:
      `setDeny` in class `RequestFilterValve`
    Parameters:
      `input` - The list of netmasks, as a comma separated string
    Throws:
      `IllegalArgumentException` - One or more netmasks are invalid

  - ### invoke

    public void invoke(Request request, Response response) throws IOException, ServletException
    Description copied from class: `RequestFilterValve`
    Extract the desired request property, and pass it (along with the specified request and response objects) to the protected `process()` method to perform the actual filtering. This method must be implemented by a concrete subclass.
    Specified by:
      `invoke` in interface `Valve`
    Specified by:
      `invoke` in class `RequestFilterValve`
    Parameters:
      `request` - The servlet request to be processed
      `response` - The servlet response to be created
    Throws:
      `IOException` - if an input/output error occurs
      `ServletException` - if a servlet error occurs

  - ### isAllowed

    public boolean isAllowed(String property)
    Description copied from class: `RequestFilterValve`
    Perform the test implemented by this Valve, matching against the specified request property value. This method is public so that it can be called through JMX, e.g. to test whether certain IP address is allowed or denied by the valve configuration.
    Overrides:
      `isAllowed` in class `RequestFilterValve`
    Parameters:
      `property` - The request property value on which to filter
    Returns:
      `true` if the request is allowed

  - ### getLog

    protected Log getLog()
    Description copied from class: `RequestFilterValve`
    Returns the logger instance used by this valve.
    Specified by:
      `getLog` in class `RequestFilterValve`
    Returns:
      the logger