Annotation Type RoutingName


  • @Target({TYPE,METHOD,FIELD})
    @Retention(RUNTIME)
    @Documented
    public @interface RoutingName
    Binds an Application or Service to a specific (named) routing on WebServer. The routing should have a corresponding named socket configured on the WebServer to run the routing on. Configuration can be overridden using configuration:
    • Name of routing: fully.qualified.ClassName.routing-name.name to change the name of the named routing. Use "@default" to revert to default named routing.
    • Whether routing is required: fully.qualified.ClassName.routing-name.required
    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-name:
      name: "@default"
      required: false
     
    • Field Summary

      Fields 
      Modifier and Type Fields Description
      static String CONFIG_KEY_NAME
      Configuration key of the routing name, appended after the fully qualified class name (does not contain the leading dot).
      static String CONFIG_KEY_REQUIRED
      Configuration key of the routing name required flag, appended after the fully qualified class name (does not contain the leading dot).
      static String DEFAULT_NAME
      Name (reserved) for the default listener of WebServer.
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String value
      Name of a routing to bind this application/service to.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean required
      Set to true if the value() MUST be configured.
    • Field Detail

      • CONFIG_KEY_NAME

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

        static final String CONFIG_KEY_REQUIRED
        Configuration key of the routing name required flag, appended after the fully qualified class name (does not contain the leading dot).
      • DEFAULT_NAME

        static final String DEFAULT_NAME
        Name (reserved) for the default listener of WebServer.
    • Element Detail

      • value

        String value
        Name of a routing to bind this application/service to.
        Returns:
        name of a routing (or listener host/port) on WebServer
      • required

        boolean required
        Set to true if the value() MUST be configured.
        Returns:
        true to enforce existence of the named routing
        Default:
        false