Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to create an html form to send http message with multipart/mixed mime type
    primarykey
    data
    text
    <p>I am creating a restful web service that processes multiple files from users. from google it seems that the correct mime type should be multipart/mixed so my java web service code (based on Jersey) is something like:</p> <pre><code>@POST @Consumes(MultiPartMediaTypes.MULTIPART_MIXED) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Path("/{Id}") public CourseBean updateCourse(@PathParam("Id") final String id, final MultiPart multipart) throws WebServiceException { //operations on multipart String this.id = id; return null; } </code></pre> <p>in the browser, I run below html to try to upload files to the web service: </p> <pre><code>&lt;h1&gt;&lt;/h1&gt; &lt;p&gt;files&lt;/p&gt; &lt;FORM action="http://localhost:8080/rest/1" enctype="multipart/mixed" method="POST"&gt; &lt;p&gt; name:&lt;INPUT type="text" name="submit-name"&gt;&lt;BR&gt; file &lt;INPUT type="file" name="file"&gt;&lt;BR&gt; attachment &lt;INPUT type="file" name="attachment"&gt;&lt;BR&gt; &lt;INPUT type="submit" value="Send"&gt; &lt;INPUT type="reset"&gt; &lt;/FORM&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>please note that the enctype here is "<strong>multipart/mixed</strong>". however after I select files and click the send button, the mime type of the http request my web service gets is changed to <strong>application/x-www-form-urlencoded</strong>, and this causes a "Unsupported Media Type" error in the web service side.</p> <p>but if I change the enctype in the html to <strong>multipart/form-data</strong>, the mime type of the received request is the same: <strong>multipart/form-data</strong>.</p> <p>so my question is, how can I create a html form that can send a http message with mime type "multipart/mixed"? with this html, I can test my web service.</p> <p>thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload