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

Not possible to acces embedded multipart using rest easy MultipartInput

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 3.0.12.Final
    • 2.3.7.Final
    • None
    • None

      When receiving embedded multipart as MultipartInput, it is not possible to access the embedded multipart portion of the multipart, you always get an exception because the input part have to be either be of type text or binary.

      The embedded multipart portion of the message is parsed as a Multipart but the methods offered on the InputPart to access the body only expect binary or text so when trying to get the body of the multipart as a Multipart, it always throws a NullPointerException.

      Here's an example of embedded mutipart which is causing the problem.

      POST /rest/v2/session/0045-ab42-89a2/filetransfer/v1/tel%3A%2B1234567890/sessions/ HTTP/1.1
      Accept: application/json, text/html
      Content-Type: multipart/mixed,boundary="boundary1"

      --boundary1
      Content-Disposition: form-data,name="root-fields"
      Content-Type: application/json
      Content-Length: 12345

      {
      "fileTransferSessionInformation": {
      "fileInformation": {
      "fileDisposition":"Attachment",
      "fileSelector":

      { "name":"myfile.jpg", "type":"image/jpeg", "size": 2345 }

      },
      "originatorAddress":"tel:+1234567890",
      "receiverAddress":"tel:+987654321"
      }
      }

      --boundary1
      Content Disposition: form-data;name="attachment"
      Content-Type: multipart/mixed; boundary="boundary2"

      --boundary2
      Content-Disposition: attachment;filename="myfile.jpg"
      Content-Type:image/jpeg

      …Binary data…

      -boundary2-

      -boundary1-

      We worked around the issue by using a MimeMultipart instead of a MultipartInput but I think the MultipartInpuit should provide a way to access embedded multipart.

              rsigal@redhat.com Ronald Sigal
              frigorn Francois Paulhus (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: