Hi
I just suspect that payload is missing some characters, can you try with
curl or wget ? If Content-Id is not available then in case of
multipart/form-data Content-Disposition name attribute will be checked -
it is tested on the trunk I believe
Cheers, Sergey
On 25/10/11 18:46, Davis Ford wrote:
Hi Sergey, a couple quick follow-up questions...
I commited a new version, take a look at the server:
https://github.com/davisford/kickstarter/blob/master/src/main/java/com/example/fileupload/FileUploadServiceImpl.java
Line 52 is where I receive the upload multipart/form-data
I also cleaned up the client side -- much easier using the FormData
object...no need for a form at all.
https://github.com/davisford/kickstarter/blob/master/src/main/webapp/js/fileupload.js
--
line 45 does the POST
Here is what is sent from client to server. You are right, there is no
content-type for the "file-metadata" part of the body. I'm not sure how to
set this in the client -- will take a look and see if it is possible.
My remaining question is that I tried to do what you suggested looking up
the Attachment directly by part name, but it does not work:
On line 55 of the FileUploadServiceImpl.java I do this:
Attachment a = body.getAttachment("file-metadata");
*
*
...and it returns null. Any idea why?
1. Request URL:
http://localhost:8080/rest/fileupload/upload
2. Request Method:
POST
3. Status Code:
200 OK
4. Request Headersview source
1. Accept:
*/*
2. Accept-Charset:
ISO-8859-1,utf-8;q=0.7,*;q=0.3
3. Accept-Encoding:
gzip,deflate,sdch
4. Accept-Language:
en-US,en;q=0.8
5. Connection:
keep-alive
6. Content-Length:
5214
7. Content-Type:
multipart/form-data; boundary=----WebKitFormBoundaryF8F4CpQ3B5evboGC
8. Host:
localhost:8080
9. Origin:
http://localhost:8080
10. Referer:
http://localhost:8080/
11. User-Agent:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like
Gecko) Chrome/14.0.835.202 Safari/535.1
5. Request Payload
1. ------WebKitFormBoundaryF8F4CpQ3B5evboGC Content-Disposition:
form-data; name="file-metadata"
<file><name>service-inspector.bmml</name><lastModified>Wednesday, October
05,
2011</lastModified><md5>5e11a7ae83e157aec2900fc54306d3ef</md5><size>4699</size><contentType>application/xml</contentType></file>
------WebKitFormBoundaryF8F4CpQ3B5evboGC Content-Disposition: form-data;
name="file-content"; filename="service-inspector.bmml" Content-Type:
application/xml ------WebKitFormBoundaryF8F4CpQ3B5evboGC--
6. Response Headersview source
1. Content-Length:
0
2. Content-Type:
text/xml
3. Date:
Tue, 25 Oct 2011 17:38:15 GMT
4. Server:
Jetty(6.1.18)
On Tue, Oct 25, 2011 at 10:08 AM, Sergey Beryozkin<[email protected]>wrote:
Note that you can avoid working with DataHandlers, try
body.getAttachmentObject("**file-metadata", FileUploadFile.class);
same for InputStream.
If a no reader exception is thrown then it means the matching part
has no Content-Type set, can you please capture the input, using the tcp
trace or CXF LoggingInInterceptor ?
Cheers, Sergey