My form POJO:

    public class FileUploadForm {

      private byte[] data;

      private String user;

      private String password;

      private String filename;

      public FileUploadForm() {}

      public byte[] getData() {
       return data;

      public void setData(final byte[] data) {
 = data;

      public String getUser() {
        return user;

      public void setUser(String user) {
        this.user = user;

      public String getPassword() {
        return password;

      public void setPassword(String password) {
        this.password = password;

       public String getFilename() {
        return filename;

      public void setFilename(String filename) {
        this.filename = filename;


My service side method definition:

    public Response upload(@MultipartForm FileUploadForm form);

I tried this:

    MockHttpRequest request ="/upload");


    FileUploadForm upload = new FileUploadForm();




    String fileToUpload = "testdata/";

    FileInputStream fis = new FileInputStream(fileToUpload);

    byte[] fileData = IOUtils.toByteArray(fis);



    MockHttpResponse response = new MockHttpResponse();

    dispatcher.invoke(request, response);

    assertEquals(HttpResponseCodes.SC_OK, response.getStatus());

But I get

2013-01-24 16:25:14,903: WARN  
[org.jboss.resteasy.core.SynchronousDispatcher](?:?)  - Failed executing POST 

org.jboss.resteasy.spi.ReaderException: Unable to get 
boundary for multipart



Please consider the environment before printing this email.
NIWA is the trading name of the National Institute of Water & Atmospheric 
Research Ltd.
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
Resteasy-users mailing list

Reply via email to