Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multipart requests to support multipart-mixed type #5

Open
subwiz opened this issue Mar 20, 2014 · 10 comments
Open

Multipart requests to support multipart-mixed type #5

subwiz opened this issue Mar 20, 2014 · 10 comments
Assignees

Comments

@subwiz
Copy link
Member

subwiz commented Mar 20, 2014

At present, multipart requests can only have String part and File part. There was a request in #4 for having multipart-mixed type like:

Content-Type: multipart/form-data; boundary=AaB03x

--AaB03x
Content-Disposition: form-data; name="submit-name"

Larry
--AaB03x
Content-Disposition: form-data; name="files"
Content-Type: multipart/mixed; boundary=BbC04y

--BbC04y
Content-Disposition: file; filename="file1.txt"
Content-Type: text/plain

... contents of file1.txt ...
--BbC04y
Content-Disposition: file; filename="file2.gif"
Content-Type: image/gif
Content-Transfer-Encoding: binary

...contents of file2.gif...
--BbC04y--
--AaB03x--

Source: http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2

@igiguere
Copy link

Hi;
I need to be able to set (at least) a different Content-Disposition header for each File part of a Multipart request. The UI REST client only allows setting the Content-Type header for each File part.
Each File part should be allowed to be sent with it's own headers, not just Content-Type.
Do you have a workaround I could use right now ?

Content-Type: multipart/mixed; boundary=AaB03x
--AaB03x
Content-Type: application/xml
Content-Disposition: metadata; filename="1.xml"
... contents of file1.xml ...
--AaB03x
Content-Type: application/octet-stream
Content-Disposition: content; filename="1"
... contents of file1 ...

@subwiz
Copy link
Member Author

subwiz commented Mar 15, 2015

At present we do not support :( I will take this as a requirement.

subwiz added a commit that referenced this issue Mar 16, 2015
@subwiz
Copy link
Member Author

subwiz commented Mar 16, 2015

The last two commits add support for multipart/mixed Content-type. I saw the list of Content-Disposition values here. @igiguere , in this list I don't see the values you mentioned content and metadata.

@igiguere
Copy link

@subwiz : The values "content" and "metadata" are defined in our code, to take different action based on those values. That's why the request sender needs control over the value of Content-Disposition.

@subwiz
Copy link
Member Author

subwiz commented Mar 16, 2015

Thanks for the input. Will work on this when I have available time.

@subwiz
Copy link
Member Author

subwiz commented Mar 17, 2015

Had a look at this. there seems to be more than just multipart/form-data and multipart/mixed Content-types. A tool like RESTClient must implement flexibility, and the current UI I designed may not be sufficient.

@subwiz subwiz self-assigned this Mar 23, 2015
@subwiz
Copy link
Member Author

subwiz commented Mar 23, 2015

This issue has three requests:

  1. Support for multipart/mixed Content-Type. This is implemented in for the top-http header now.
  2. Support for multipart/mixed Content-Type for sub-parts. This may not be supported by the tool in immediate future.
  3. Changing the Content-Disposition header. The backend API I am currently using is not supporting this. I will raise this as a request in that project and wait.

@subwiz
Copy link
Member Author

subwiz commented Mar 27, 2015

Oleg has given an answer in the above SO question:

FormBodyPart bodyPart = FormBodyPartBuilder.create()
        .setName("blah")
        .addField("Content-Disposition", "blah")
        .setBody(new StringBody("blah", ContentType.TEXT_PLAIN))
        .build();
HttpEntity entity = MultipartEntityBuilder.create()
        .addPart(bodyPart)
        .build();
entity.writeTo(System.out);

Need to develop the UI and implement this.

@subwiz
Copy link
Member Author

subwiz commented Apr 1, 2015

Self-note, multipart-part content with fields:

<file>
  <content>/path/to/file</content>
  <fields>
    <field>
      <name>name</name>
      <value>value</value>
    </field>
  </fields>
</file>

subwiz added a commit that referenced this issue Apr 4, 2015
persistence support added for part custom headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants