Ingo,
I have a client side fix for it, which I tested and it works fine. I have
created a patch for it on the latest WebdavResource obtained from CVS Head.
Could you please take a look at it? I am attaching it here.
The fix is basically computing the length of the data from the InputStream
by using *available* method.
Regards,
Ritu
-----Original Message-----
From: Ingo Brunberg [mailto:[EMAIL PROTECTED]
Sent: Friday, July 23, 2004 6:14 PM
To: [EMAIL PROTECTED]
Subject: Re: Facing problem with version-controlling a resource created
by Cop y method in BindingStore
This looks like Slide fails to compute the getcontentlength if a
resource is PUT using "Transfer-Encoding: chunked". In fact there are
statements in PutMethod that look like this:
revisionDescriptor.setContentLength(req.getContentLength());
This is not sufficient. When using chunked transfer-encoding the
content-length has to be computed from the data actually received.
Anyone wants to file a bugreport?
Ingo
> On further investigation of this matter, I found the source of the problem
> with versioning a copied resource.
> I am creating a resource using:
> WebdavResource.putMethod(String path, InputStream fileStream)
> This creates a resource fine but the *getcontentlength* property of the
> resource is set to -1.
> Therefore when I copy this resource, there must be some problem though the
> copy call returns fine without any errors.
> I face an error only when I try to version control this copied resource.
>
> I am certain about the cause of the bug (which is getcontentlength
property
> being set to -1), because I tested by manually modifying the
> getcontentlength property and then repeating the steps of copy and
> versioncontrol. It worked fine.
>
> This getcontentlength property bug happens only when using InputStream
with
> putMethod. When using File argument, everything goes fine.
>
> Does anyone know the fix for this bug?
>
> Thanks and Regards,
> Ritu
>
>
> -----Original Message-----
> From: Ritu Kedia [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 16, 2004 6:25 PM
> To: Slide Users Mailing List (E-mail)
> Subject: Facing problem with version-controlling a resource created by
> Cop y method in BindingStore
>
>
> Has anyone faced a problem with *Put Under Version Control* on a resource
> created by *Copy* when using BindingStore?
>
> I get the following error message: 500 Internal Server Error: Revision 1.0
> of object /xxxxxx not found.
>
> If anyone could give me any hints on what is causing this, it would be
very
> helpful.
>
> Thanks & Regards,
> Ritu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Index: WebdavResource.java
===================================================================
RCS file:
/home/cvspublic/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java,v
retrieving revision 1.23
diff -u -r1.23 WebdavResource.java
--- WebdavResource.java 13 Jul 2004 13:29:59 -0000 1.23
+++ WebdavResource.java 23 Jul 2004 13:18:58 -0000
@@ -2612,7 +2612,10 @@
generateIfHeader(method);
if (getGetContentType() != null && !getGetContentType().equals(""))
method.setRequestHeader("Content-Type", getGetContentType());
- method.setRequestContentLength(PutMethod.CONTENT_LENGTH_CHUNKED);
+ int contentLength = is.available();
+ method.setRequestContentLength(contentLength <= Integer.MAX_VALUE
+
? contentLength
+
: PutMethod.CONTENT_LENGTH_CHUNKED);
method.setRequestBody(is);
generateTransactionHeader(method);
int statusCode = client.executeMethod(method);
@@ -2657,6 +2660,10 @@
generateIfHeader(method);
if (getGetContentType() != null && !getGetContentType().equals(""))
method.setRequestHeader("Content-Type", getGetContentType());
+ int contentLength = data.length();
+ method.setRequestContentLength(contentLength <= Integer.MAX_VALUE
+
? contentLength
+
: PutMethod.CONTENT_LENGTH_CHUNKED);
method.setRequestBody(data);
generateTransactionHeader(method);
int statusCode = client.executeMethod(method);
@@ -2752,7 +2759,12 @@
generateIfHeader(method);
if (getGetContentType() != null && !getGetContentType().equals(""))
method.setRequestHeader("Content-Type", getGetContentType());
- method.setRequestBody(url.openStream());
+ InputStream is = url.openStream();
+ int contentLength = is.available();
+ method.setRequestContentLength(contentLength <= Integer.MAX_VALUE
+
? contentLength
+
: PutMethod.CONTENT_LENGTH_CHUNKED);
+ method.setRequestBody(is);
generateTransactionHeader(method);
int statusCode = client.executeMethod(method);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]