The boundary is declared in the header of the "original" HTTP request. All you
have below is a single mime body part.
The original request would have had a content-type header something like this:
content-type: multipart/report; report-type=disposition-notification;
boundary="----=_Part_6_17038270.1191609292302"
That is, if it were valid...
You need to get the boundary from the header of the original HTTP request.
...Pete
Starbucks Coffee Co.
2401 Utah Ave S.
Seattle, WA. 98134
(work)206-318-5933
(cell)206-226-4552
After hours emergency pager:
206-314-2054 or [email protected]
-----Original Message-----
From: Richard Jones [mailto:[email protected]]
Sent: Monday, June 08, 2009 3:38 AM
To: [email protected]
Subject: unable to read mime boundary headers
Hi Folks,
I'm trying to read headers from a mime boudary, with no success. Can
anyone tell me what I'm doing wrong here (with version 3.1 of http client):
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<DiskFileItem> items = upload.parseRequest(request);
for (DiskFileItem item : items)
{
String ct = item.getContentType();
FileItemHeaders hed = item.getHeaders();
String cd = hed.getHeader("Content-Disposition");
}
At this point, hed is always null (so the final line throws an NPE).
Perplexingly, though, the content type variable contains the content
type. The http request is definitely valid, and contains a mime
boundary thus:
--NlWHLgeBI76ZytSdNwyoMKnfTjSG8ocZuIh
Content-Disposition: form-data; name="atom"; filename="atom.xml"
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Any suggestions? Something wrong with the DiskFileItem implementation?
A mis-use of getHeaders?
Cheers,
Richard
--
Richard Jones
Head Repository Systems Architect, Symplectic Limited
e: [email protected]
t: 0845 026 4755
t: +44 (0)207 7334036
w: http://www.symplectic.co.uk/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]