Class RouteImplHelper


  • public class RouteImplHelper
    extends Object
    A helper to access the results of the Vert.x route parser, for use in Irked support for dynamic runtime parameter configuration for controller methods, to circumvent Vert.x limits on access to the immutable RouteState. The parser results frankly should be accessible to the application for various reasons, but instead they are "secured" as "package private", which does nothing to prevent access and only serves to hinder useful implementations. Furthermore, the RouteState class is immutable and public access cannot even be abused for unsupported operations, so there really isn't any need to actively prevent access to it. This class is used by the Irked configuration stage (before the HTTP server is started, and before the real Route Objects are created) to parse the route annotations on Controller methods, in a compatible way to the Vert.x-web Router. Because of the intentional limitations put on the Vert.x-web Route public API, this implementation relies on specifics of the Vert.x-web internal implementation, i.e. the RouteImpl class, but it also requires "package private" access to the RouterImpl#state() method. All access is read-only to an immutable value using the class API. Generally, we just need the a RouteState instance that contains the parsed results, but unfortunately not only does RouteState not have a public constructor - most of the parsing code whose results are presented by RouteState is actually in RouteImpl.
    Author:
    odeda
    • Constructor Detail

      • RouteImplHelper

        public RouteImplHelper​(Router router,
                               String path)
        Parse the specified route path for the specified Irked router, by creating a standalone RouteImpl
        Parameters:
        router - Irked router that needs this path parsed
        path - route path to parse
    • Method Detail

      • getState

        public io.vertx.ext.web.impl.RouteState getState()
        Expose the parsed RouteState result. This is the method that Vert.x-web RouteImpl is so protective of, and that we had to replace.
        Returns:
        a RouteState instance containing the result of parsing the path that was submitted.
      • listParameters

        public Set<String> listParameters()
        Retrieve the list of named path parameters that are specified by the submitted path
        Returns:
        a set of names for named path parameters