hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Read attached file from webpage
Date Thu, 29 Dec 2011 19:56:57 GMT
On Wed, 2011-12-28 at 13:22 -0800, dhollacher wrote:
> There appears to have been no actvity on this topic since 2009 -- but the
> question is STILL important to me -- how do you retrieve an attached file,
> such as the one referenced here:
> 
> HTTP/1.1 200 OK [Date: Wed, 28 Dec 2011 19:51:29 GMT, Server: XXX XX Web,
> Content-Length: 0, Content-Disposition:
> attachment;filename="contracts_and_schedules.xml";, Keep-Alive: timeout=5,
> max=98, Connection: Keep-Alive, Content-Type: text]
> 
> ??
> 
> Note that the Content-Length is 0.  I am converting from standard
> javax.net.HttpURLConnection use to HttpClient 4 -- my original program just
> opened an InputStream on the connection and did .read().  But since the
> Content is empty, getEntity().getContent() returns nothing.
> 
> I know that this isn't addressed by the HTTP standard - I'm dealing with a
> VERY non-standard service, but I am surprised that there is apparently no
> way to address this using the HttpCLient.
> 

There is. What you need to do is to force the underlying HTTP connection
to treat such message as being identity delimited instead of content
length delimited by using a custom EntityDeserializer and a custom
ContentLengthStrategy  

Oleg



---------------------------------------------------------------------
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