Hi,Pushparajan At 09:31 01/11/01, PUSHPARAJAN,RAMAR (Non-HP-India,ex2) wrote > >Hi, > >Can you please email me your updated code.(WebdavResource.java). As your >mail should I comment all the methods or only the Put Method?
You may comment out all the methods or only the PutMethod. I think these import statements are old interfaces before making wrapper org.apache.webdav.lib.methods.*Method . So I commented out all methods. I will send you WebdavResource.java and 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; >*/ > > >Thanks and Regards >Pushparajan > >-----Original Message----- >From: Yoshiyuki Kumadaki [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, October 31, 2001 11:00 AM >To: Slide Users List >Subject: Re: Slide command line - uploads zero byte files > > >Hi, >I am sorry for my miss post. >(I add 2.3 needContentLength()) > >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); > > } > >2.3 add this method to be not remove Content-Length > If I don't add this method, then above Content-Length will be removed > > public boolean needContentLength() { > return false; > } > > >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: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- Yoshiyuki Kumadaki / 熊懐 善之 Web Japan Co.,Ltd / (株)ウエブジャパン <http://www.webjp.co.jp/> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
