@Singleton public class ResolverSvc extends java.lang.Object implements ResolverService
ResolverService.Holder
Constructor and Description |
---|
ResolverSvc() |
Modifier and Type | Method and Description |
---|---|
java.util.Optional<java.lang.String> |
getPluginInChargeOf(java.lang.String target) |
java.util.Optional<Resolver> |
getResolver(java.lang.String target)
Obtain a
Resolver for a 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInstance
public void register()
public void registerResolver(java.lang.String pluginName, java.lang.String start, Resolver resolver)
ResolverService
registerResolver
in interface ResolverService
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 thispublic void registerResolverForMatches(java.lang.String pluginName, java.util.regex.Pattern pattern, Resolver resolver)
ResolverService
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.
registerResolverForMatches
in interface ResolverService
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.public java.util.Optional<Resolver> getResolver(java.lang.String target)
ResolverService
Resolver
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 than ResolverService.registerResolverForMatches(java.lang.String, java.util.regex.Pattern, com.djrapitops.plan.delivery.web.resolver.Resolver)
.
Can be used when making Resolver middleware.
getResolver
in interface ResolverService
target
- "/example/target"public java.util.Optional<java.lang.String> getPluginInChargeOf(java.lang.String target)