hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pete Keyes <PKe...@starbucks.com>
Subject RE: unable to read mime boundary headers
Date Mon, 08 Jun 2009 14:31:08 GMT
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 page-pkeyes@starbucks.com
 

-----Original Message-----
From: Richard Jones [mailto:richard@symplectic.co.uk] 
Sent: Monday, June 08, 2009 3:38 AM
To: httpclient-users@hc.apache.org
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: richard@symplectic.co.uk
t: 0845 026 4755
t: +44 (0)207 7334036
w: http://www.symplectic.co.uk/


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message