Annotation Interface Http.HeaderParam

Enclosing class:
Http

@Target({PARAMETER,RECORD_COMPONENT}) @Retention(CLASS) @Documented @Qualifier public static @interface Http.HeaderParam
Inject a request header into a server method parameter, or send a header from a declarative client method parameter.

Can also be used on Http.RequestParams record components.

Declarative server endpoints support List<T> for mandatory multi-value headers and Optional<List<T>> for optional multi-value headers. A mandatory list is rejected when the named header is missing, while an optional list is empty when the named header is missing. If the named header is present with no values, the injected list is empty.

Declarative clients send every value from List<T> and send Optional<List<T>> only when the optional is present.

Declarative client values must not be null. Use Optional.empty() to omit optional values. Client list values must not contain null elements.

  • Required Element Summary

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

    • value

      String value
      Name of the header.
      Returns:
      name of the header