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

POJO with empty InputStream field returned as "mutlipart/form-data" produces no headers in multipart

XMLWordPrintable

      Service:
      @Path("/rest/zba")
      public class Service {
      @GET
      @Produces(MediaType.MULTIPART_FORM_DATA)
      public @MultipartForm
      MyBean get()

      { MyBean myBean = new MyBean(); myBean.setSomeBinary(new ByteArrayInputStream(new byte[0])); return myBean; }

      }
      MyBean:
      public class MyBean {
      @FormParam("someBinary")
      @PartType(MediaType.APPLICATION_OCTET_STREAM)
      private InputStream someBinary;

      public InputStream getSomeBinary()

      { return someBinary; }

      public void setSomeBinary(InputStream someBinary)

      { this.someBinary = someBinary; }

      }

      outputs:
      --f231sldkxx11

      -f231sldkxx11-

      if I use byte[] instead of InputStream the output is correct:
      --f231sldkxx11
      Content-Length: 0
      Content-Disposition: form-data; name="someBinary"
      Content-Type: application/octet-stream

      -f231sldkxx11-

              patriot1burke@gmail.com Bill Burke (Inactive)
              akiraly Attila Király (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: