Este contenido no está disponible en el idioma seleccionado.

Chapter 10. @Form


This is a RESTEasy-specific annotation that allows you to reuse any @*Param annotation within an injected class. RESTEasy instantiates the class and injects values into any annotated @*Param or @Context property. This is useful if you have many parameters on your method and you want to condense them into a value object.
public class MyForm {

   @FormParam("stuff")
   private int stuff;


   @HeaderParam("myHeader")
   private String header;


   @PathParam("foo")
   public void setFoo(String foo) {...}
}



@POST
@Path("/myservice")
public void post(@Form MyForm form) {...}
Copy to Clipboard Toggle word wrap
When someone posts to /myservice, RESTEasy instantiates an instance of MyForm and injects the form parameter stuff into the stuff field, the header myheader into the header field, and call the setFoo method with the @PathParam variable of foo.
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat