Annotation Interface Http.PathParam

Enclosing class:
Http

@Target({PARAMETER,RECORD_COMPONENT}) @Retention(CLASS) @Documented @Qualifier public static @interface Http.PathParam
Inject a path parameter into a server method parameter, or provide a path template value from a declarative client method parameter.

Server path parameters are obtained from the path template of the routing method.

Declarative server endpoints may use Optional<T>, but the optional cannot be empty for a matched route; if the path parameter were missing, the route would not match.

Declarative clients use path parameter values as URI path text. They do not encode each value as a single path segment before constructing the request URI.

Declarative client path parameter values must not be null. If Optional<T> is used, the optional value itself must not be null and must be present; empty optional path values are rejected.

Can also be used on Http.RequestParams record components.

Declarative server endpoints support List<T> for mandatory multi-value path parameters and Optional<List<T>> for optional multi-value path parameters. A matched route provides the named path parameter; if it were missing, the route would not match. If the named path parameter is present with no values, the injected list is empty.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of the parameter.
  • Element Details

    • value

      String value
      Name of the parameter.
      Returns:
      name of the path parameter