java.lang.Object
com.djrapitops.plan.delivery.web.resolver.FunctionalResolverWrapper
- All Implemented Interfaces:
Resolver
public class FunctionalResolverWrapper
extends Object
implements Resolver
Utility class for constructing a
Resolver
with Functional Interfaces.
-
Constructor Summary
Constructors
-
Method Summary
boolean
Implement access control if authorization is enabled.
Implement request resolution.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
FunctionalResolverWrapper
Default constructor.
- Parameters:
resolver
- Function that solves the Request
into an Optional Response
.
accessCheck
- Predicate that checks if Request
is allowed or if 403 Forbidden should be given.
-
Method Details
-
canAccess
public boolean canAccess(Request request)
Description copied from interface: Resolver
Implement access control if authorization is enabled.
Is not called when access control is not active.
- Specified by:
canAccess
in interface Resolver
- Parameters:
request
- HTTP request, contains all information necessary to check access.
- Returns:
- true if allowed or invalid target, false if response should be 403 (forbidden)
- See Also:
-
-
resolve
Description copied from interface: Resolver
Implement request resolution.
- Specified by:
resolve
in interface Resolver
- Parameters:
request
- HTTP request, contains all information necessary to resolve the request.
- Returns:
- Response or empty if the response should be 404 (not found).
- See Also:
-