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 robert <Ro...@collabraspace.com> on 2005/04/11 17:38:20 UTC

RequestEntity.getContentLength ?

Hello,

I'm implementing this interface to write an indeterminate amount of bytes
to the server during an HTTP Post.  Everything seems to be working ok,
however I just have one question.  The JavaDoc API for this interface says
that getContentLength returns
"either a number >= 0 or EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED"

So I think, ok I need to return 
EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED.

However,  the JavaDoc API for EntityEnclosingMethod says that
CONTENT_LENGTH_CHUNKED is deprecated and to use
setContentChunked(true) instead.  I'm doing this already on the
PostMethod.  What should I return in my implementation of
RequestEntity.getContentLength ? (Right now "0" seems to work ok)

Rob Manning



CollabraSpace - Revolutionary Collaboration
Visit us at http://www.collabraspace.com
This message has been scanned for viruses by
ClamAV v0.83



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


Re: RequestEntity.getContentLength ?

Posted by Oleg Kalnichevski <ol...@apache.org>.
Robert,

You can monitor this bug report to keep track of the progress in
resolving the issue that you have reported

http://issues.apache.org/bugzilla/show_bug.cgi?id=34459

You can expect a patch by the end of the week

Cheers,

Oleg


On Wed, 2005-04-13 at 17:24 -0400, robert wrote:
> Oleg,
> 
> Thank you for the clarification.  I'll use -1 instead of
> 
> EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED
> 
> for now.  I just hate to see deprecation warnings in the code if
> it can be helped :)
> 
> Rob
> 
> Oleg Kalnichevski wrote:
> 
> >Hi Robert,
> >
> >Javadocs are indeed inconsistent. I'll review the code and make sure
> >that the javadocs correctly reflect the implementation
> >
> >Thanks for pointing out the problem
> >
> >Oleg
> >
> >RequestEntity.getContentLength should return a non-negative number if
> >the content length is known and a negative when it is not. In the latter
> >case HttpClient will have to buffer 
> >
> >  
> >
> 
> 
> 
> CollabraSpace - Revolutionary Collaboration
> Visit us at http://www.collabraspace.com
> This message has been scanned for viruses by
> ClamAV v0.83
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 


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


Re: RequestEntity.getContentLength ?

Posted by Oleg Kalnichevski <ol...@apache.org>.
Robert,
Unfortunately I am unable to give any definitive clarifications
regarding the correct use of RequestEntity#getContentLength at this
point. I'll have to carefully review the code, which is quite complex.
The EntityEnclosingMethod method contains A LOT of awful code necessary
to maintain backward compatibility with 2.0.x API. I spotted a few
things that did not quite like and need a little more time to sort
things out properly. I'll keep everyone posted on the outcome.

Oleg

On Wed, 2005-04-13 at 17:24 -0400, robert wrote:
> Oleg,
>
> Thank you for the clarification.  I'll use -1 instead of
> 
> EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED
> 
> for now.  I just hate to see deprecation warnings in the code if
> it can be helped :)
> 
> Rob
> 
> Oleg Kalnichevski wrote:
> 
> >Hi Robert,
> >
> >Javadocs are indeed inconsistent. I'll review the code and make sure
> >that the javadocs correctly reflect the implementation
> >
> >Thanks for pointing out the problem
> >
> >Oleg
> >
> >RequestEntity.getContentLength should return a non-negative number if
> >the content length is known and a negative when it is not. In the latter
> >case HttpClient will have to buffer 
> >
> >  
> >
> 
> 
> 
> CollabraSpace - Revolutionary Collaboration
> Visit us at http://www.collabraspace.com
> This message has been scanned for viruses by
> ClamAV v0.83
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 


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


Re: RequestEntity.getContentLength ?

Posted by robert <Ro...@collabraspace.com>.
Oleg,

Thank you for the clarification.  I'll use -1 instead of

EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED

for now.  I just hate to see deprecation warnings in the code if
it can be helped :)

Rob

Oleg Kalnichevski wrote:

>Hi Robert,
>
>Javadocs are indeed inconsistent. I'll review the code and make sure
>that the javadocs correctly reflect the implementation
>
>Thanks for pointing out the problem
>
>Oleg
>
>RequestEntity.getContentLength should return a non-negative number if
>the content length is known and a negative when it is not. In the latter
>case HttpClient will have to buffer 
>
>  
>



CollabraSpace - Revolutionary Collaboration
Visit us at http://www.collabraspace.com
This message has been scanned for viruses by
ClamAV v0.83



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


Re: RequestEntity.getContentLength ?

Posted by Oleg Kalnichevski <ol...@apache.org>.
Hi Robert,

Javadocs are indeed inconsistent. I'll review the code and make sure
that the javadocs correctly reflect the implementation

Thanks for pointing out the problem

Oleg

RequestEntity.getContentLength should return a non-negative number if
the content length is known and a negative when it is not. In the latter
case HttpClient will have to buffer 

On Mon, 2005-04-11 at 11:38 -0400, robert wrote:
> Hello,
> 
> I'm implementing this interface to write an indeterminate amount of bytes
> to the server during an HTTP Post.  Everything seems to be working ok,
> however I just have one question.  The JavaDoc API for this interface says
> that getContentLength returns
> "either a number >= 0 or EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED"
> 
> So I think, ok I need to return 
> EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED.
> 
> However,  the JavaDoc API for EntityEnclosingMethod says that
> CONTENT_LENGTH_CHUNKED is deprecated and to use
> setContentChunked(true) instead.  I'm doing this already on the
> PostMethod.  What should I return in my implementation of
> RequestEntity.getContentLength ? (Right now "0" seems to work ok)
> 
> Rob Manning
> 
> 
> 
> CollabraSpace - Revolutionary Collaboration
> Visit us at http://www.collabraspace.com
> This message has been scanned for viruses by
> ClamAV v0.83
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 


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