« Return to Thread: unable to read mime boundary headers

unable to read mime boundary headers

by Richard Jones-28 :: Rate this Message:

Reply to Author | View in Thread

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@...
t: 0845 026 4755
t: +44 (0)207 7334036
w: http://www.symplectic.co.uk/


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

 « Return to Thread: unable to read mime boundary headers