How to use the WebDAV server in custom Java application?

Hi,

I am trying to manage content via a custom java Application. As per the architechure diagrams I belive the WebDAV is built on Slide project. How do I access the Slide API in my custom application?

Regards
Pushparajan

Hello Pushparajan,

The Tamino WebDAV Server uses Slide as the central WebDAV engine. All the Slide jar files are packed with Tamino WebDAV Server. The Slide version is 1.0.13 (with some minor bug fixes contained in Slide version 1.0.14).

We do not expose the Slide Content Management API officially and there is the Slide documentation available only. This might be something for further versions. Currently the best source of information would be http://jakarta.apache.org/slide.

Using the installed slide-kernel.jar will give you access to the Slide Content Management API. The API itself is not fully supported by the Tamino store, e.g. no versioning or ACL support yet. Again, this is something for coming versions. For the non-versioned access it will be fully operable, this is the internal API used by the WebDAV layer.

Best regards

Juergen

P.S. If possible I would currently suggest to use the WebDAV protocol or API.

Hi,

How do I use the generic command line webdav client? (I tried the one that comes with Slide (Slide.java)). I have a problem with the put method. The put always creats a zero length file.

Regards
Pushparajan

Hi,

I’ve interesting article on this regard from, http://www.apacheweek.com/features/put

"There is some confusion about whether Apache supports the PUT method. In fact, Apache handles PUT exactly like it handles the POST method. That is, it supports it, but in order for it to do anything useful you need to supply a suitable CGI program. This is on contrast to the GET method, which Apache supports internally by sending back files or SSI documents. "

But how does the windows explorer be able to upload a file to Tamino WebDAV properly?

Regards
Pushparajan

Hello Pushparajan,

its not Apache, that handles the PUT request. It is passed directly to Tamino WebDAV Server.

Regards,
Martin

Hi,

this from the Slid forum, one of our freinds had the same problem and has a fix. I am yet to try the fix. hope this will be taken care in the next release or build or Tamino WebDAV server as well.

Regards
Pushparajan

----
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: mailto:slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: mailto:slide-user-help@jakarta.apache.org

Hi,

there is one more step left out. It is listed below.

Regards
Pushparajan

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;
}