title: Form post through REST Client - Multipart Upload
body: <p>I'm trying to use REST Client for Firefox as a mock form to post multipart file data to a Spring 3-driven controller and subsequent handlers. I have our Web Services project configured such that we are able to send XML/JSON requests, which are marshaled/unmarshaled and consumed in the usual way. When I try to use the enctype="multipart/form-data" (by sending the Content-Type="multipart/form-data"), I immediately get :</p>
  
  <pre><code>org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
  </code></pre>
  
  <p>I've been sure to include this in my rest-servlet configuration :</p>
  
  <pre><code>&lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
      &lt;property name="maxUploadSize" value="100000"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Thinking that this was a limitation of the commons FileUpload jar version, I tried to older releases, but to no avail. Same with my REST Client, trying both <a href="http://code.google.com/p/rest-client/" rel="nofollow noreferrer">this</a> and <a href="http://www.ywebb.com/" rel="nofollow noreferrer">this</a></p>
  
  <p>My ultimate goal would be to have JAXB marshal a specified file into an object that contains a byte[] automatically. For a great reference as to what I'd like to see, <a href="https://stackoverflow.com/questions/5723429/use-rest-client-to-call-multipart-form-data-rest-web-service">this post</a> hits exactly that, but it uses RESTEasy as the implementation, whereas I use Spring 3 (and this cannot be changed).</p>
  
  <p>Ideally, POSTing this XML :</p>
  
  <pre><code>&lt;fileUpload&gt;
      &lt;username&gt;user123&lt;/username&gt;
      &lt;localFileToBeUploaded&gt;path/to/file&lt;/localFileToBeUploaded&gt;
  &lt;/fileUpload&gt;
  </code></pre>
  
  <p>Would result in an FileUpload object containing the username as a String and the file as either a byte array, InputStream, or actual File object, which gets mapped to some specific controller for handling. I'm comfortable with the XML marshaling, but I'm lost as to how to deal with the file aspect.</p>
  
  <p>Is this possible or am I mixing two different paradigms? I haven't been able to come across anything like this, which leads me to believe I'm a little out in left field. Any ideas or comments would be hugely helpful. Thank you!</p>