此内容没有您所选择的语言版本。
20.11. @MultipartForm and POJOs
If you are familiar with your
multipart/form-data packets, you can map them to and from a POJO class with the @org.jboss.resteasy.annotations.providers.multipart.MultipartForm annotation and the @FormParam JAX-RS annotation. To do so, define a POJO with a default constructor (at least), and annotate its fields, properties, or both, with @FormParams. These @FormParams must also be annotated with @org.jboss.resteasy.annotations.providers.multipart.PartType to be output. For example:
Once you have defined your POJO class, you can use it to represent
multipart/form-data. The following code sends a CustomerProblemForm using the RESTEasy client framework:
Note that the
@MultipartForm annotation tells RESTEasy that the object has @FormParam, and that it should be marshaled from that parameter. You can use the same object to receive multipart data. Here is an example of the server-side counterpart to the customer portal.