Annotation Interface Http.CookieParam

Enclosing class:
Http

@Target({PARAMETER,RECORD_COMPONENT}) @Retention(CLASS) @Documented @Qualifier public static @interface Http.CookieParam
Inject a request cookie into a server method parameter, or send a cookie from a declarative client method parameter. Cookie names are validated during declarative code generation. Declarative clients do not escape cookie values; each value must already be a valid cookie-octet value.

Can also be used on Http.RequestParams record components.

Declarative server endpoints support List<T> for mandatory multi-value cookies and Optional<List<T>> for optional multi-value cookies. A mandatory list is rejected when the named cookie is missing, while an optional list is empty when the named cookie is missing. Cookies are not represented as Parameters; a named cookie cannot be present with no values.

Declarative clients send cookie parameters as a single Cookie header. They send every value from List<T> and send Optional<List<T>> only when the optional is present. A mandatory client List<T> cookie parameter must contain at least one value.

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 cookie.
  • Element Details

    • value

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