Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2575

@MultipartForm does not support lists in POJO forms

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None
    • jaxrs
    • None

    Description

      I have the following form class where the list parameter comes from a <select multiple> in the HTML UI.

      public class MyForm {
      
      	@FormParam("list")
      	List<Integer> list;
      }
      
      @POST
      @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
      public Response urlEncoded(@BeanParam MyForm form) { ... }
      

      When I add a method to handle multipart/form-data (because a file could also be uploaded at the same time) with @MultipartForm

      @POST
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      public Response multipart(@MultipartForm MyForm form) { ... }
      

      the list parameter stopped working and I got the following error:

      RESTEASY007545: Unable to find a MessageBodyReader for media type: text/plain; charset=us-ascii and class type java.util.List
      

      So, java.util.List's seem to work when they are sent in urlencoded forms (list=3&list=5&list=8) but not anymore when sent in multipart (where there are multiple parts with the same name list). It seems like resteasy wants a MBR to convert a single part into a list whereas it should convert each part separately and give the result in a list.

      Attachments

        Activity

          People

            Unassigned Unassigned
            xavierdury Xavier Dury (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: