Interface ResolverService
It is recommended to use plugin based namespace in your custom targets,
eg. "/flyplugin/flying" to avoid collisions with other plugins.
You can also use getResolver(String)
to check if target already has a resolver.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResolverService
getResolver
(String target) Obtain aResolver
for a target.getResolvers
(String target) Obtain all Resolvers that match the target.void
registerPermission
(String webPermission, String whenHasPermission) Register a new permission that you are using in yourResolver.canAccess(Request)
method.registerPermissions
(String... webPermissions) Register a new permission that you are using in yourResolver.canAccess(Request)
method.void
registerResolver
(String pluginName, String start, Resolver resolver) Register a new resolver.void
registerResolverForMatches
(String pluginName, Pattern pattern, Resolver resolver) Register a new resolver with regex that matches start of target.
-
Method Details
-
getInstance
-
registerResolver
Register a new resolver.- Parameters:
pluginName
- Name of the plugin that is registering (For error messages)start
- Start of the target to match against, eg "/example" will send "/example/target" etc to the Resolver.resolver
-Resolver
to use for this- Throws:
IllegalArgumentException
- If pluginName is null or empty.
-
registerResolverForMatches
Register a new resolver with regex that matches start of target.NOTICE: It is recommended to avoid too generic regex like "/.*" to not override existing resolvers.
Parameters (?param=value) are not included in the regex matching.
- Parameters:
pluginName
- Name of the plugin that is registering (For error messages)pattern
- Regex Pattern, "/example.*" will send "/exampletarget" etc to the Resolver.resolver
-Resolver
to use for this.- Throws:
IllegalArgumentException
- If pluginName is null or empty.
-
registerPermissions
Register a new permission that you are using in yourResolver.canAccess(Request)
method.The permissions are not given to any users by default, and need to be given by admin manually.
- Parameters:
webPermissions
- Permission strings, higher level permissions grant lower level automatically - eg. page.foo also grants page.foo.bar- Returns:
- CompletableFuture that tells when the permissions have been stored.
-
registerPermission
Register a new permission that you are using in yourResolver.canAccess(Request)
method.The permission is granted to any groups with
whenHasPermission
parameter.- Parameters:
webPermission
- Permission string, higher level permissions grant lower level automatically - eg. page.foo also grants page.foo.barwhenHasPermission
- Permission that a group already has that this permission should be granted to - eg. page.network.overview.numbers
-
getResolver
Obtain aResolver
for a target.First matching resolver will be returned.
registerResolver(java.lang.String, java.lang.String, com.djrapitops.plan.delivery.web.resolver.Resolver)
resolvers have higher priority thanregisterResolverForMatches(java.lang.String, java.util.regex.Pattern, com.djrapitops.plan.delivery.web.resolver.Resolver)
.Can be used when making Resolver middleware.
- Parameters:
target
- "/example/target"- Returns:
- Resolver if registered or empty.
-
getResolvers
Obtain all Resolvers that match the target.If first returns Optional.empty next one should be used.
Requires Capability PAGE_EXTENSION_RESOLVERS_LIST.
- Parameters:
target
- "/example/target"- Returns:
- List of Resolvers if registered or empty list.
-