Top Fields Constructors Methods
org.apache.catalina.valves

public final Class RemoteCIDRValve

extends RequestFilterValve
Class Inheritance
Imports
java.io.IOException, java.net.InetAddress, .UnknownHostException, java.util.ArrayList, .Collections, .List, jakarta.servlet.ServletException, org.apache.catalina.connector.Request, .Response, org.apache.catalina.util.NetMask, org.apache.juli.logging.Log, .LogFactory

Field Summary

Modifier and TypeField and Description
private final List<NetMask>
private final List<NetMask>
private static final Log
Inherited from org.apache.catalina.valves.RequestFilterValve:
allowValidallowValuedenyStatusdenyValiddenyValue

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private List<String>

Returns:

a string list of processing errors (empty when no errors)
fillFromInput
(final String
The input string
input
,
final List<NetMask>
The list to fill
target
)

Fill a NetMask list from a string input containing a comma-separated list of (hopefully valid) NetMasks.

public String

Returns:

the #allow list as a string, without the leading '[' and trailing ']'
getAllow
()

Overrides org.apache.catalina.valves.RequestFilterValve.getAllow.

Return a string representation of the NetMask list in #allow.

public String

Returns:

the #deny list as a string, without the leading '[' and trailing ']'
getDeny
()

Overrides org.apache.catalina.valves.RequestFilterValve.getDeny.

Return a string representation of the NetMask list in #deny.

protected Log
public void
invoke(final Request
The servlet request to be processed
request
,
final Response
The servlet response to be created
response
)

Implements abstract org.apache.catalina.valves.RequestFilterValve.invoke.

Implements org.apache.catalina.Valve.invoke.

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.

public boolean
isAllowed(final String
The request property value on which to filter
property
)

Overrides org.apache.catalina.valves.RequestFilterValve.isAllowed.

Perform the test implemented by this Valve, matching against the specified request property value.

public void
setAllow(final String
The list of netmasks, as a comma separated string
input
)

Overrides org.apache.catalina.valves.RequestFilterValve.setAllow.

Fill the #allow list with the list of netmasks provided as an argument, if any.

public void
setDeny(final String
The list of netmasks, as a comma separated string
input
)

Overrides org.apache.catalina.valves.RequestFilterValve.setDeny.

Fill the #deny list with the list of netmasks provided as an argument, if any.

Inherited from org.apache.catalina.valves.RequestFilterValve:
denyRequestgetAddConnectorPortgetDenyStatusgetInvalidAuthenticationWhenDenygetUsePeerAddressinitInternalisAllowValidisDenyValidprocesssetAddConnectorPortsetDenyStatussetInvalidAuthenticationWhenDenysetUsePeerAddressstartInternal

Field Detail

allowback to summary
private final List<NetMask> allow

Hides org.apache.catalina.valves.RequestFilterValve.allow.

The list of allowed NetMasks

denyback to summary
private final List<NetMask> deny

Hides org.apache.catalina.valves.RequestFilterValve.deny.

The list of denied NetMasks

logback to summary
private static final Log log

Hides org.apache.catalina.util.LifecycleMBeanBase.log.

Our logger

Constructor Detail

RemoteCIDRValveback to summary
public RemoteCIDRValve()

Method Detail

fillFromInputback to summary
private List<String> fillFromInput(final String input, final List<NetMask> target)

Fill a NetMask list from a string input containing a comma-separated list of (hopefully valid) NetMasks.

Parameters
input:String

The input string

target:List<NetMask>

The list to fill

Returns:List<String>

a string list of processing errors (empty when no errors)

getAllowback to summary
public String getAllow()

Overrides org.apache.catalina.valves.RequestFilterValve.getAllow.

Return a string representation of the NetMask list in #allow.

Returns:String

the #allow list as a string, without the leading '[' and trailing ']'

Annotations
@Override
getDenyback to summary
public String getDeny()

Overrides org.apache.catalina.valves.RequestFilterValve.getDeny.

Return a string representation of the NetMask list in #deny.

Returns:String

the #deny list as a string, without the leading '[' and trailing ']'

Annotations
@Override
getLogback to summary
protected Log getLog()

Implements abstract org.apache.catalina.valves.RequestFilterValve.getLog.

Annotations
@Override
invokeback to summary
public void invoke(final Request request, final Response response) throws IOException, ServletException

Implements abstract org.apache.catalina.valves.RequestFilterValve.invoke.

Implements org.apache.catalina.Valve.invoke.

Doc from org.apache.catalina.valves.RequestFilterValve.invoke.

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.

Parameters
request:Request

The servlet request to be processed

response:Response

The servlet response to be created

Annotations
@Override
Exceptions
IOException:
if an input/output error occurs
ServletException:
if a servlet error occurs
isAllowedback to summary
public boolean isAllowed(final String property)

Overrides org.apache.catalina.valves.RequestFilterValve.isAllowed.

Doc from org.apache.catalina.valves.RequestFilterValve.isAllowed.

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.

Parameters
property:String

The request property value on which to filter

Returns:boolean

true if the request is allowed

Annotations
@Override
setAllowback to summary
public void setAllow(final String input)

Overrides org.apache.catalina.valves.RequestFilterValve.setAllow.

Fill the #allow list with the list of netmasks provided as an argument, if any. Calls #fillFromInput.

Parameters
input:String

The list of netmasks, as a comma separated string

Annotations
@Override
Exceptions
IllegalArgumentException:
One or more netmasks are invalid
setDenyback to summary
public void setDeny(final String input)

Overrides org.apache.catalina.valves.RequestFilterValve.setDeny.

Fill the #deny list with the list of netmasks provided as an argument, if any. Calls #fillFromInput.

Parameters
input:String

The list of netmasks, as a comma separated string

Annotations
@Override
Exceptions
IllegalArgumentException:
One or more netmasks are invalid