Interface ResolverService


  • public interface ResolverService
    Service for modifying webserver request resolution.

    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.

    • Method Detail

      • registerResolver

        void registerResolver​(java.lang.String pluginName,
                              java.lang.String start,
                              Resolver resolver)
        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:
        java.lang.IllegalArgumentException - If pluginName is null or empty.
      • registerResolverForMatches

        void registerResolverForMatches​(java.lang.String pluginName,
                                        java.util.regex.Pattern pattern,
                                        Resolver resolver)
        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.

        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:
        java.lang.IllegalArgumentException - If pluginName is null or empty.
      • getResolvers

        java.util.List<Resolver> getResolvers​(java.lang.String target)
        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.