Package io.undertow.server.handlers
Class AccessControlListHandler
- java.lang.Object
-
- io.undertow.server.handlers.AccessControlListHandler
-
- All Implemented Interfaces:
HttpHandler
public class AccessControlListHandler extends java.lang.Object implements HttpHandler
Handler that can accept or reject a request based on an attribute of the remote peer todo: should we support non-regex values for performance reasons?- Author:
- Stuart Douglas, Andre Dietisheim
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAccessControlListHandler.Builder
-
Constructor Summary
Constructors Constructor Description AccessControlListHandler(ExchangeAttribute attribute)AccessControlListHandler(HttpHandler next, ExchangeAttribute attribute)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessControlListHandleraddAllow(java.lang.String pattern)Adds an allowed user agent peer to the ACL listAccessControlListHandleraddDeny(java.lang.String pattern)Adds an denied user agent to the ACL listAccessControlListHandlerclearRules()HttpHandlergetNext()voidhandleRequest(HttpServerExchange exchange)Handle the request.booleanisDefaultAllow()AccessControlListHandlersetDefaultAllow(boolean defaultAllow)AccessControlListHandlersetNext(HttpHandler next)
-
-
-
Constructor Detail
-
AccessControlListHandler
public AccessControlListHandler(HttpHandler next, ExchangeAttribute attribute)
-
AccessControlListHandler
public AccessControlListHandler(ExchangeAttribute attribute)
-
-
Method Detail
-
handleRequest
public void handleRequest(HttpServerExchange exchange) throws java.lang.Exception
Description copied from interface:HttpHandlerHandle the request.- Specified by:
handleRequestin interfaceHttpHandler- Parameters:
exchange- the HTTP request/response exchange- Throws:
java.lang.Exception
-
isDefaultAllow
public boolean isDefaultAllow()
-
setDefaultAllow
public AccessControlListHandler setDefaultAllow(boolean defaultAllow)
-
getNext
public HttpHandler getNext()
-
setNext
public AccessControlListHandler setNext(HttpHandler next)
-
addAllow
public AccessControlListHandler addAllow(java.lang.String pattern)
Adds an allowed user agent peer to the ACL listUser agent may be given as regex
- Parameters:
pattern- The pattern to add to the ACL
-
addDeny
public AccessControlListHandler addDeny(java.lang.String pattern)
Adds an denied user agent to the ACL listUser agent may be given as regex
- Parameters:
pattern- The user agent to add to the ACL
-
clearRules
public AccessControlListHandler clearRules()
-
-