Annotation Interface Path


Declares a path prefix that contributes to the final URI of a web handler.

The @Path annotation can be placed on packages, classes, methods, and properties (fields or getters). Path values from outer levels (e.g. packages or enclosing classes) are chained with inner levels unless a path starts with /, in which case the chain is reset and the path is treated as absolute.

If a @Path value is empty, the system will fall back to using the simple name of the latest package, (e.g. com.example.usersusers).

When @Path is placed on a property (field or getter), its value is used dynamically at runtime to determine the path segment. In that case, the annotation is expected to be used without an explicit value. The runtime property value will follow the same chaining rules: if it starts with a slash, it resets the path.

Examples


 @Path
 package com.example.api;

 @Path("users")
 public class UserController {
     @HandleGet("/{id}")
     WebResponse getUser(@PathParam String id) { ... }
 }

 // Resolves to: /api/users/{id}
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Defines the URI path segment.
  • Element Details

    • value

      String value
      Defines the URI path segment. If omitted (i.e. the value is empty), the simple name of the class or package is used. If the value starts with '/', it is treated as an absolute path and resets any previously chained segments.
      Default:
      ""