io.undertow.server.handlers

## Class IPAddressAccessControlHandler

- java.lang.Object
- - io.undertow.server.handlers.IPAddressAccessControlHandler

All Implemented Interfaces:
  HttpHandler

    public class IPAddressAccessControlHandler
    extends Object
    implements HttpHandler

Handler that can accept or reject a request based on the IP address of the remote peer.

Author:
  Stuart Douglas

### Nested Class Summary

Nested Classes
`static class` `IPAddressAccessControlHandler.Builder`

### Constructor Summary

Constructors
Constructor and Description
`IPAddressAccessControlHandler()`
`IPAddressAccessControlHandler(HttpHandler next)`
`IPAddressAccessControlHandler(HttpHandler next, int denyResponseCode)`

### Method Summary

All Methods Instance Methods Concrete Methods
`IPAddressAccessControlHandler` `addAllow(String peer)` Adds an allowed peer to the ACL list
`IPAddressAccessControlHandler` `addDeny(String peer)` Adds an denied peer to the ACL list
`IPAddressAccessControlHandler` `clearRules()`
`int` `getDenyResponseCode()`
`HttpHandler` `getNext()`
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.
`boolean` `isDefaultAllow()`
`IPAddressAccessControlHandler` `setDefaultAllow(boolean defaultAllow)`
`IPAddressAccessControlHandler` `setNext(HttpHandler next)`
`String` `toString()`

### Methods inherited from class java.lang.Object

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

### Constructor Detail

#### IPAddressAccessControlHandler

    public IPAddressAccessControlHandler(HttpHandler next)

#### IPAddressAccessControlHandler

    public IPAddressAccessControlHandler(HttpHandler next,
                                         int denyResponseCode)

#### IPAddressAccessControlHandler

    public IPAddressAccessControlHandler()

### Method Detail

#### handleRequest

    public void handleRequest(HttpServerExchange exchange)
                       throws Exception

Description copied from interface: `HttpHandler`
Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`

#### getDenyResponseCode

    public int getDenyResponseCode()

#### isDefaultAllow

    public boolean isDefaultAllow()

#### setDefaultAllow

    public IPAddressAccessControlHandler setDefaultAllow(boolean defaultAllow)

#### getNext

    public HttpHandler getNext()

#### setNext

    public IPAddressAccessControlHandler setNext(HttpHandler next)

#### addAllow

    public IPAddressAccessControlHandler addAllow(String peer)

Adds an allowed peer to the ACL list

Peer can take several forms:

a.b.c.d = Literal IPv4 Address a:b:c:d:e:f:g:h = Literal IPv6 Address a.b.* = Wildcard IPv4 Address a:b:* = Wildcard IPv6 Address a.b.c.0/24 = Classless wildcard IPv4 address a:b:c:d:e:f:g:0/120 = Classless wildcard IPv6 address

Parameters:
  `peer` - The peer to add to the ACL

#### addDeny

    public IPAddressAccessControlHandler addDeny(String peer)

Adds an denied peer to the ACL list

Peer can take several forms:

a.b.c.d = Literal IPv4 Address a:b:c:d:e:f:g:h = Literal IPv6 Address a.b.* = Wildcard IPv4 Address a:b:* = Wildcard IPv6 Address a.b.c.0/24 = Classless wildcard IPv4 address a:b:c:d:e:f:g:0/120 = Classless wildcard IPv6 address

Parameters:
  `peer` - The peer to add to the ACL

#### clearRules

    public IPAddressAccessControlHandler clearRules()

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`