You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by dhollacher <ok...@ionet.net> on 2012/01/03 18:05:33 UTC

Re: Read attached file from webpage

Thank you for responding. I did review those classes and the default
implementations, but making that kind of adaptation requires a much deeper
knowledge of the HttpClient design than I possess.  I'm not confident at
this stage that I could be successful, so I'm reverting to use of
HttpsUrlConnection.  
I sincerely appreciate your courtesy and assistance.  

respects,  d.


olegk wrote:
> 
> 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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Read-attached-file-from-webpage-tp25358160p33073284.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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