You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2011/04/06 12:00:30 UTC

Re: getting a "* Couldn't find MIME boundary" error when implement a REST WS to upload files

Hi

Thanks for sending the details.

I think it is a bug in the way CXF processes multipart/form-data.
I've checked this doc [1], what CXF does now is that expects multiple files
be submitted, i.e, it expects recursive multiparts when it sees a
multipart/form-data with Content-Disposition containing a name="files".
However, it should only try to recurse if the Content-Type of the individual
part is multipart/mixed, according to [1].

I'll get it fixed, thanks

[1] http://www.w3.org/TR/html401/interact/forms.html

here is the msg:

POST /erp/service/upload HTTP/1.1
Accept: image/jpeg, application/x-ms-application, image/gif,
application/xaml+xml, image/pjpeg, application/x-ms-xbap,
application/x-shockwave-flash, application/msword, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/QVOD, application/QVOD, */*
Referer: http://localhost:8081/erp/index.jsp
Accept-Language: zh-CN
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;
SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media
Center PC 6.0)
Content-Type: multipart/form-data;
boundary=---------------------------7db3743271760
Accept-Encoding: gzip, deflate
Host: 127.0.0.1
Content-Length: 305
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: __activedNodeId=120; JSESSIONID=3830AE531A95229252E001677ED45EF3

-----------------------------7db3743271760
Content-Disposition: form-data; name="name"

888
-----------------------------7db3743271760
Content-Disposition: form-data; name="file";
filename="C:\Users\chenzp\Desktop\1.txt"
Content-Type: text/plain

ok
-----------------------------7db3743271760--

Re: getting a "* Couldn't find MIME boundary" error when implement a REST WS to upload files

Posted by Sergey Beryozkin <sb...@gmail.com>.
Actually, all is working as expected for me, I added a test verifying it,
see [1], MultipartProvider does recurse only if Content-Disposition has a
multipart/* Content-Type.

Sam, you mentioned you were modifying Content-Type in the CXF interceptor,
why do you do ? Looks like that is affecting the processing...

Cheers, Sergey

[1] http://svn.apache.org/viewvc?rev=1089407&view=rev

On Wed, Apr 6, 2011 at 11:00 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> Thanks for sending the details.
>
> I think it is a bug in the way CXF processes multipart/form-data.
> I've checked this doc [1], what CXF does now is that expects multiple files
> be submitted, i.e, it expects recursive multiparts when it sees a
> multipart/form-data with Content-Disposition containing a name="files".
> However, it should only try to recurse if the Content-Type of the individual
> part is multipart/mixed, according to [1].
>
> I'll get it fixed, thanks
>
> [1] http://www.w3.org/TR/html401/interact/forms.html
>
>
> here is the msg:
>
> POST /erp/service/upload HTTP/1.1
> Accept: image/jpeg, application/x-ms-application, image/gif,
> application/xaml+xml, image/pjpeg, application/x-ms-xbap,
> application/x-shockwave-flash, application/msword, application/vnd.ms-excel,
> application/vnd.ms-powerpoint, application/QVOD, application/QVOD, */*
> Referer: http://localhost:8081/erp/index.jsp
> Accept-Language: zh-CN
> User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;
> SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media
> Center PC 6.0)
> Content-Type: multipart/form-data;
> boundary=---------------------------7db3743271760
> Accept-Encoding: gzip, deflate
> Host: 127.0.0.1
> Content-Length: 305
> Connection: Keep-Alive
> Cache-Control: no-cache
> Cookie: __activedNodeId=120; JSESSIONID=3830AE531A95229252E001677ED45EF3
>
> -----------------------------7db3743271760
> Content-Disposition: form-data; name="name"
>
> 888
> -----------------------------7db3743271760
> Content-Disposition: form-data; name="file";
> filename="C:\Users\chenzp\Desktop\1.txt"
> Content-Type: text/plain
>
> ok
> -----------------------------7db3743271760--
>
>
>


-- 
Sergey Beryozkin

Application Integration Division of Talend <http://www.talend.com>
http://sberyozkin.blogspot.com