You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by "PUSHPARAJAN,RAMAR (Non-HP-India,ex2)" <ra...@non.hp.com> on 2001/10/30 00:44:21 UTC
Slide command line - uploads zero byte files
> Hi,
>
> I've downloaded the Slide source and Binanries. I compiled the Slide
> Client (Slide.java). When I do an PUT command it always creates a new file
> in the webdav directory with zero byte length. All other commands like
> dir, get etc work properly. Pls help me fix this.
>
> Regards
> Pushparajan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Slide command line - uploads zero byte files
Posted by Yoshiyuki Kumadaki <ku...@webjp.co.jp>.
Hi,
I have same trouble. I am using some original Webdav server.
The Webdav server does not accept PUT Header without Content-Length:
So I have modified WebdavResource, PutMethod.
I hope to be supported by Slide.
PUT(file) : easy to implement
Content-Length: file.length()
PUT(InputStream) : I add setContentLength(length)
to be called before calling PUT(InputStream)
1 WebdavResource
1) coment out import statement of httpclient.method
Because I would like to modify org.apache.webdav.lib.method.PutMethod
rather than org.apache.commons.httpclient.methods.PutMethod
/*
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
*/
2) Add setContentLength(long length) method for Put(InputStream)
private long contentLength = -1 ;
/**
* Set Content-Length for Not File.
* @param length of InputStream PUT data
*
*/
public void setContentLength(long contentLength) {
this.contentLength = contentLength;
}
3) Chnage calling sequence method.sendData(
except method.sendData(file);
/* modified PUT
From method.sendData( is,byte[] data,string data,url
--> method.setContentLength(contentLength);method.sendData(
*/
/* ex. original
method.sendData(is);
to */
method.setContentLength(contentLength);
method.sendData(is);
2. org.apache.webdav.lib.PutMethod
private long contentLength = -1;
/**
* Set Content-Length for Not File.
* @param length of InputStream PUT data
*
*/
public void setContentLength(long contentLength) {
this.contentLength = contentLength;
}
2.1 sendData(file)
public void sendData(File file)
throws IOException {
setHeader("Content-Length", String.valueOf(file.length()) ) ;
super.sendData(file);
}
2.2 sendData(!file)
sendData(String data) sendData(InputStream is)
sendData(byte[] data) sendData(URL url)
public void sendData(InputStream is)
throws IOException {
if (contentLength >= 0){
setHeader("Content-Length", String.valueOf(
contentLength ) );
contentLength = -2;
}
super.sendData(is);
}
At 13:51 01/10/30, Remy Maucherat wrote:
>
>> > Hi,
>> >
>> > I've downloaded the Slide source and Binanries. I compiled the Slide
>> > Client (Slide.java). When I do an PUT command it always creates a new
>file
>> > in the webdav directory with zero byte length. All other commands like
>> > dir, get etc work properly. Pls help me fix this.
>
>What is the server you're using ? Because of a variety of problems with the
>HTTP client, chunking is used when uploading with a PUT if the server is
>HTTP/1.1, which is something some servers don't like.
>Tomcat 4.0 should work ok. Tomcat 3.x should also be ok (it will be
>identified as a HTTP/1.0 server) in standalone.
>
>Remy
--
Yoshiyuki Kumadaki/熊懐 善之
Web Japan Co.,Ltd /(株)ウエブジャパン
<http://www.webjp.co.jp/>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Slide command line - uploads zero byte files
Posted by Remy Maucherat <rm...@home.com>.
> > Hi,
> >
> > I've downloaded the Slide source and Binanries. I compiled the Slide
> > Client (Slide.java). When I do an PUT command it always creates a new
file
> > in the webdav directory with zero byte length. All other commands like
> > dir, get etc work properly. Pls help me fix this.
What is the server you're using ? Because of a variety of problems with the
HTTP client, chunking is used when uploading with a PUT if the server is
HTTP/1.1, which is something some servers don't like.
Tomcat 4.0 should work ok. Tomcat 3.x should also be ok (it will be
identified as a HTTP/1.0 server) in standalone.
Remy
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>