Package com.djrapitops.plan.delivery.web
Class ResolverSvc
- java.lang.Object
-
- com.djrapitops.plan.delivery.web.ResolverSvc
-
- All Implemented Interfaces:
ResolverService
@Singleton public class ResolverSvc extends java.lang.Object implements ResolverService
ResolverService Implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.djrapitops.plan.delivery.web.ResolverService
ResolverService.Holder
-
-
Constructor Summary
Constructors Constructor Description ResolverSvc()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
getPluginInChargeOf(java.lang.String target)
java.util.Optional<Resolver>
getResolver(java.lang.String target)
Obtain aResolver
for a target.java.util.List<Resolver>
getResolvers(java.lang.String target)
Obtain all Resolvers that match the target.void
register()
void
registerResolver(java.lang.String pluginName, java.lang.String start, Resolver resolver)
Register a new resolver.void
registerResolverForMatches(java.lang.String pluginName, java.util.regex.Pattern pattern, Resolver resolver)
Register a new resolver with regex that maches start of target.
-
-
-
Method Detail
-
register
public void register()
-
registerResolver
public void registerResolver(java.lang.String pluginName, java.lang.String start, Resolver resolver)
Description copied from interface:ResolverService
Register a new resolver.- Specified by:
registerResolver
in interfaceResolverService
- 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
-
registerResolverForMatches
public void registerResolverForMatches(java.lang.String pluginName, java.util.regex.Pattern pattern, Resolver resolver)
Description copied from interface:ResolverService
Register a new resolver with regex that maches 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.
- Specified by:
registerResolverForMatches
in interfaceResolverService
- 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.
-
getResolver
public java.util.Optional<Resolver> getResolver(java.lang.String target)
Description copied from interface:ResolverService
Obtain aResolver
for a target.First matching resolver will be returned.
ResolverService.registerResolver(java.lang.String, java.lang.String, com.djrapitops.plan.delivery.web.resolver.Resolver)
resolvers have higher priority thanResolverService.registerResolverForMatches(java.lang.String, java.util.regex.Pattern, com.djrapitops.plan.delivery.web.resolver.Resolver)
.Can be used when making Resolver middleware.
- Specified by:
getResolver
in interfaceResolverService
- Parameters:
target
- "/example/target"- Returns:
- Resolver if registered or empty.
-
getResolvers
public java.util.List<Resolver> getResolvers(java.lang.String target)
Description copied from interface:ResolverService
Obtain all Resolvers that match the target.If first returns Optional.empty next one should be used.
Requires Capability PAGE_EXTENSION_RESOLVERS_LIST.
- Specified by:
getResolvers
in interfaceResolverService
- Parameters:
target
- "/example/target"- Returns:
- List of Resolvers if registered or empty list.
-
getPluginInChargeOf
public java.util.Optional<java.lang.String> getPluginInChargeOf(java.lang.String target)
-
-