Annotation Interface FormParam


@Retention(RUNTIME) @Target(PARAMETER) public @interface FormParam
Injects an individual form field or multipart part into a handler method parameter.

The request must use application/x-www-form-urlencoded or multipart/form-data. Standard validation annotations may be declared directly on the injected parameter.

Multipart parts can be injected as WebFormPart to access headers, filename, content type, and bytes. Text fields can be injected as String; file contents can be injected as byte[] or java.io.InputStream.

Examples:

@HandlePost("/newsletter")
void subscribe(@FormParam @NotBlank String email) { ... }

@HandlePost("/user")
UserId createUser(@FormParam UserForm form) { ... }
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Form parameter name.
  • Element Details

    • value

      String value
      Form parameter name. If left empty, it defaults to the method parameter's name;
      Default:
      ""