hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jennifer Ward <jennif...@apple.com>
Subject Re: Getting exception: Unbuffered entity enclosing request can not be repeated
Date Tue, 13 Jul 2004 18:05:53 GMT
Thanks for the reply. Unfortunately, I tried setting the Content-Length 
header (no chunked transfer encoding), but that didn't work either.

I would appreciate any other suggestions you may have.

Sincerely,
Jennifer Ward

On Jul 13, 2004, at 12:20 AM, Ingo Brunberg wrote:

> The problem is that you are using chunked transfer encoding. This
> prevents Httpclient to automatically buffer the content in memory and
> the InputStream can only be read once.
>
> The workaround is simply to provide the exact content-length.
>
> Ingo
>
>> Hi,
>>
>> I wonder if anyone could offer a suggestion for getting around an
>> exception I'm seeing.
>>
>> I am writing a load test client that sends requests to a webdav 
>> server.
>> I have a putMethod which does the following:
>>
>> 			PutMethod method = new PutMethod(URIUtil.encodePathQuery(path));
>> 			generateIfHeader(method);
>> 			if (getGetContentType() != null && !getGetContentType().equals(""))
>> 				method.setRequestHeader("Content-Type", getGetContentType());
>> 			method.setRequestContentLength(PutMethod.CONTENT_LENGTH_CHUNKED);
>> 			method.setRequestBody(bis);
>> 			int statusCode = client.executeMethod(method);
>>
>> bis is a BufferedInputStream.
>>
>> This method works fine when sending requests using Basic
>> authentication. However, I want to use Digest authentication (I have
>> setAuthenticationPreemptive set to false). When sending the request
>> using Digest, I get the exception:
>>
>> org.apache.commons.httpclient.HttpException: Unbuffered entity
>> enclosing request can not be repeated.
>>
>> In looking at the code, it appears that
>> EntityEnclosingMethod.writeRequestBody does not cache the request 
>> body.
>> So, when the request is resent (with the digest auth header), the
>> contentCache is null, thus the exception.
>>
>> Does anyone know of a way around this?
>>
>> Thanks,
>> Jennifer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>


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


Mime
View raw message