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 Ilya Kharmatsky <il...@mainsoft.com> on 2004/12/15 23:57:26 UTC

write buffering

Hi, All!

I'm writing some layer above the http client.
I need to provide to user following functionality:
  1. Handle automatically all redirects / failures.
  2. Be able to buffer in memory the request (in post, put methods)
  3. Max number of redirections.

As I can understand from the code (I'm using version 3.0 beta1),
if I won't set the content length, the request will be buffered, but
I'll loose automatic redirections / failures handling. Am I right?
What is a workaround?

Max number of redirections - is http client supports this? I cannot
find it. The circular references will (by default parameters) throw
Exception, but if there is no such and still I wish to limit the number
of redirections?

Thanks,
Ilya Kharmatsky.

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


Re: write buffering

Posted by Oleg Kalnichevski <ol...@apache.org>.
n Thu, 2004-12-16 at 00:57 +0200, Ilya Kharmatsky wrote:
Hi, All!
> 
> I'm writing some layer above the http client.
> I need to provide to user following functionality:
>   1. Handle automatically all redirects / failures.
> 
Ilya,

HttpClient automatically handles all types of redirects but one.
HttpClient is unable to automatically handle redirects of entity
enclosing methods (such as POST and PUT). See the HttpClient redirects
handling guide for detailed explanations:

http://jakarta.apache.org/commons/httpclient/3.0/redirects.html  


>   2. Be able to buffer in memory the request (in post, put methods)
>   3. Max number of redirections.
> As I can understand from the code (I'm using version 3.0 beta1),
> if I won't set the content length, the request will be buffered, but
> I'll loose automatic redirections / failures handling. Am I right?
> What is a workaround?
> 
Entity enclosing methods with unbuffered content cannot be retried for
apparent reasons. Since the redirects of entity enclosing methods are
not supported anyhow, the only problem is authentication failure and I/O
failure recovery. The former problem can be solved by using the so
called 'expect-continue' handshake. The latter problem can be solved by
recreating the request body input stream and retrying the request. 



> Max number of redirections - is http client supports this? I cannot
> find it. The circular references will (by default parameters) throw
> Exception, but if there is no such and still I wish to limit the
> number
> of redirections?
> 
See 'http.protocol.max-redirects' parameter
http://jakarta.apache.org/commons/httpclient/3.0/preference-api.html

Hope this helps 

Oleg



> Thanks,
> Ilya Kharmatsky.
> 
> 


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