Annotation Type RoutingPath


  • @Target({TYPE,METHOD,FIELD})
    @Retention(RUNTIME)
    @Documented
    public @interface RoutingPath
    Path of a Service to register with routing. If a service is not annotated with this annotation, it would be registered without a path using Routing.Rules.register(io.helidon.webserver.Service...). Configuration can be overridden using configuration:
    • fully.qualified.ClassName.routing-path.path to change the path.
    Example class:
     @ApplicationScoped
     @RoutingPath("/myservice")
     @RoutingName(value = "admin", required = true)
     public class MyService implements Service {
         @Override
         public void update(Routing.Rules rules) {
             rules.get("/hello", (req, res) -> res.send("Hello WebServer"));
         }
     }
     
    Example configuration (yaml):
     com.example.MyService.routing-path:
      path: "/myservice-customized"
     

    Limitations

    • RequestScoped beans are NOT available for injection. Reactive services are designed to be built without request scoped injection. You can still use beans in ApplicationScoped and Dependent scopes
    • Field Summary

      Fields 
      Modifier and Type Fields Description
      static String CONFIG_KEY_PATH
      Configuration key of the routing path, appended after the fully qualified class name (does not contain the leading dot).
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String value
      Path of this WebServer service.
    • Field Detail

      • CONFIG_KEY_PATH

        static final String CONFIG_KEY_PATH
        Configuration key of the routing path, appended after the fully qualified class name (does not contain the leading dot).
    • Element Detail

      • value

        String value
        Path of this WebServer service. Use the same path as would be used with Routing.Rules.
        Returns:
        path to register the service on.