Annotation Interface 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
 
  • Required Element Summary

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

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

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

    • 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).
      See Also:
    • 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).
      See Also:
    • DEFAULT_NAME

      static final String DEFAULT_NAME
      Name (reserved) for the default listener of WebServer.
      See Also:
  • Element Details

    • 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