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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to