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 Stan Pinte <st...@axone.be> on 2003/08/11 17:47:33 UTC
more debugging info on standalone client that does not
work...whereas the command-line slide client does...
hello,
when I "put" a file using the command line client, here is what I see, at
the HTTP level (client side).
PUT /slide/files/octa/run.bat HTTP/1.1
Transfer-Encoding: chunked
Expect: 100-continue
Cookie: $Version=1;JSESSIONID=27nd1jad7peet; $Path=/slide; $Domain=localhost
Host: localhost:8081
User-Agent: Jakarta HTTP Client/1.0
c1
@echo off
set
CP2=%CLASSPATH%;../lib/webdav.jar;../lib/jaxp.jar;../lib/crimson.jar;../lib/commons-httpclient.jar
java -classpath %CP2% org.apache.webdav.cmd.Slide %1 %2 %3 %4 %5 %6 %7 %8 %9
0
when I use a java class, built on top of the WebDAV library, I get this:
PROPFIND /slide/files/octa/ HTTP/1.1
Content-Length: 207
Content-Type: text/xml; charset=utf-8
Host: localhost:8081
Depth: 0
User-Agent: Jakarta HTTP Client/1.0
<?xml version="1.0" encoding="utf-8" ?><D:propfind
xmlns:D="DAV:"><D:prop><D:displayname/><D:getcontentlength/><D:getcontenttype/><D:resourcetype/><D:getlastmodified/><D:lockdiscovery/></D:prop></D:propfind>PUT
/ HTTP/1.1
Transfer-Encoding: chunked
Expect: 100-continue
Cookie: $Version=1
Host: localhost:8081
User-Agent: Jakarta HTTP Client/1.0
95
Why does my command line client (extremely simple, code included, 30 lines)
do use the "PROPFIND" method instead of the POST?
Any idea?
Thanks a lot,
Stan.
Re: more debugging info on standalone client that does not
work...whereas the command-line slide client does...
Posted by Stan Pinte <st...@axone.be>.
Ingo,
my problem is solved.
First, I did not saw the PUT, which was stuck aside of a bunch of PROPFINDS
parameters, out of the window (you are not always scrolling, are you;-).
Then I fixed the problem by adding the tomcat context name in front of the
putMethod "path" argument.
As I run Slide in jboss, my slide is accessible here:
http://localhost:8086/slide.
within slide, I have a collection called "test" --> to put the files there,
I thought that the "path" /files/test/ was enough...I would never had
thought putting the absolute path.
Is this a bug, or an issue? In my opinion, the webDav servlet should
understand paths relatively to Slide root path, no?
Sorry, and thanks a lot.
Stan.
At 18:06 11/08/2003 +0200, Ingo Brunberg wrote:
>Hello Stan,
>
>the PROPFIND call is made whenever you create a new
>WebdavResource. This call collects some info about the resource and
>probably its children. In your client, when you try to upload a file,
>you call the putMethod() with a path of file.getName(). I guess that
>will not work because you are expected to specifiy the full path
>starting from the root node.
>
>Hope that helps,
>Ingo
>
> > hello,
> >
> > when I "put" a file using the command line client, here is what I see, at
> > the HTTP level (client side).
> >
> > PUT /slide/files/octa/run.bat HTTP/1.1
> > Transfer-Encoding: chunked
> > Expect: 100-continue
> > Cookie: $Version=1;JSESSIONID=27nd1jad7peet; $Path=/slide;
> $Domain=localhost
> > Host: localhost:8081
> > User-Agent: Jakarta HTTP Client/1.0
> >
> > c1
> > @echo off
> > set
> >
> CP2=%CLASSPATH%;../lib/webdav.jar;../lib/jaxp.jar;../lib/crimson.jar;../lib/commons-httpclient.jar
> > java -classpath %CP2% org.apache.webdav.cmd.Slide %1 %2 %3 %4 %5 %6 %7
> %8 %9
> >
> > 0
> >
> >
> > when I use a java class, built on top of the WebDAV library, I get this:
> >
> > PROPFIND /slide/files/octa/ HTTP/1.1
> > Content-Length: 207
> > Content-Type: text/xml; charset=utf-8
> > Host: localhost:8081
> > Depth: 0
> > User-Agent: Jakarta HTTP Client/1.0
> >
> > <?xml version="1.0" encoding="utf-8" ?><D:propfind
> >
> xmlns:D="DAV:"><D:prop><D:displayname/><D:getcontentlength/><D:getcontenttype/><D:resourcetype/><D:getlastmodified/><D:lockdiscovery/></D:prop></D:propfind>PUT
>
> > / HTTP/1.1
> > Transfer-Encoding: chunked
> > Expect: 100-continue
> > Cookie: $Version=1
> > Host: localhost:8081
> > User-Agent: Jakarta HTTP Client/1.0
> >
> > 95
> >
> >
> > Why does my command line client (extremely simple, code included, 30
> lines)
> > do use the "PROPFIND" method instead of the POST?
> >
> > Any idea?
> >
> > Thanks a lot,
> >
> > Stan.
> >
> > --=====================_27832260==_
> > Content-Type: text/plain; x-avg-checked=avg-ok-3AA55D59; charset=us-ascii
> > Content-Disposition: attachment; filename="WebDavClient.java"
> > Content-Transfer-Encoding: 8bit
> >
> > /**
> > *
> > *
> > */
> > package com.axone.repository;
> >
> > import java.io.*;
> > import java.net.URI;
> > import java.net.URISyntaxException;
> > import java.net.MalformedURLException;
> >
> > import org.apache.webdav.lib.WebdavResource;
> >
> > import org.apache.commons.httpclient.HttpException;
> > import org.apache.commons.httpclient.HttpStatus;
> > import org.apache.util.HttpURL;
> >
> > /**
> > * This class acts as a facade to specific
> > * implementations of WebDav libraries.
> > * Basic functionalities provided are:
> > * - add a file to the WebDav filesystem.
> > *
> > * NOTE: at first, we implement a flat storage strategy.
> > */
> > public class WebDavClient
> > {
> > private String user = "root";
> > private String password = "root";
> > private String hostPort = "";
> > private String davPath = "";
> >
> > /**
> > * add a file to the repository.
> > */
> > public URI addFile(String path) throws MalformedURLException,
> > HttpException,
> > IOException,
> > URISyntaxException
> > {
> > File file = new File(path);
> > //InputStream stream = new FileInputStream(path);
> > String fileName = file.getName();
> > WebdavResource resource = getResource();
> >
> > if (!file.exists())
> > {
> > throw new IOException("file does not exist: " + file);
> > }
> >
> > //resource.setDebug(8);
> > System.out.println("adding: [" + fileName + "]");
> > //boolean succeeded = resource.putMethod(fileName, "test
> data...\n");
> > boolean succeeded = resource.putMethod(fileName, file);
> > if (!succeeded)
> > {
> > throw new IOException(resource.getStatusMessage());
> > }
> > return new URI(hostPort + davPath + fileName);
> > }
> >
> > private WebdavResource getResource() throws MalformedURLException,
> > HttpException,
> > IOException
> > {
> > HttpURL url = new HttpURL(hostPort + davPath);
> > //HttpURL url = new
> HttpURL("http:://localhost:8086/slide/files/octa/");
> > url.setUserInfo(user, password);
> > return new WebdavResource(url);
> > }
> >
> > public void list() throws Exception
> > {
> > WebdavResource resource = getResource();
> > String[] paths = resource.list();
> >
> > for (int i=0; i<paths.length; i++)
> > {
> > System.out.println("path: " + paths[i]);
> > }
> > }
> >
> > public static void main(String[] args) throws Exception
> > {
> >
> > if (args.length != 3)
> > {
> > System.out.println("Usage: java
> com.axone.repository.WebDavClient davServer davPath documentPath");
> > System.exit(1);
> > }
> > WebDavClient client = new WebDavClient();
> > client.hostPort = args[0];
> > client.davPath = args[1];
> > System.out.println("added: [" + client.addFile(args[2]) +
> "]");
> > //client.list();
> > }
> > }
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003
Re: more debugging info on standalone client that does not
work...whereas the command-line slide client does...
Posted by Stan Pinte <st...@axone.be>.
At 18:06 11/08/2003 +0200, Ingo Brunberg wrote:
>Hello Stan,
>
>the PROPFIND call is made whenever you create a new
>WebdavResource. This call collects some info about the resource and
>probably its children. In your client, when you try to upload a file,
>you call the putMethod() with a path of file.getName(). I guess that
>will not work because you are expected to specifiy the full path
>starting from the root node.
thanks Ingo. I now understand why it calls PROPFIND.
But that does not solve my problem, unfortunately...
I changed the call
boolean succeeded = resource.putMethod(fileName, file);
to
boolean succeeded = resource.putMethod(davPath + fileName, file);
but the 404 error is still there...
thanks a lot.
>Hope that helps,
>Ingo
>
> > hello,
> >
> > when I "put" a file using the command line client, here is what I see, at
> > the HTTP level (client side).
> >
> > PUT /slide/files/octa/run.bat HTTP/1.1
> > Transfer-Encoding: chunked
> > Expect: 100-continue
> > Cookie: $Version=1;JSESSIONID=27nd1jad7peet; $Path=/slide;
> $Domain=localhost
> > Host: localhost:8081
> > User-Agent: Jakarta HTTP Client/1.0
> >
> > c1
> > @echo off
> > set
> >
> CP2=%CLASSPATH%;../lib/webdav.jar;../lib/jaxp.jar;../lib/crimson.jar;../lib/commons-httpclient.jar
> > java -classpath %CP2% org.apache.webdav.cmd.Slide %1 %2 %3 %4 %5 %6 %7
> %8 %9
> >
> > 0
> >
> >
> > when I use a java class, built on top of the WebDAV library, I get this:
> >
> > PROPFIND /slide/files/octa/ HTTP/1.1
> > Content-Length: 207
> > Content-Type: text/xml; charset=utf-8
> > Host: localhost:8081
> > Depth: 0
> > User-Agent: Jakarta HTTP Client/1.0
> >
> > <?xml version="1.0" encoding="utf-8" ?><D:propfind
> >
> xmlns:D="DAV:"><D:prop><D:displayname/><D:getcontentlength/><D:getcontenttype/><D:resourcetype/><D:getlastmodified/><D:lockdiscovery/></D:prop></D:propfind>PUT
>
> > / HTTP/1.1
> > Transfer-Encoding: chunked
> > Expect: 100-continue
> > Cookie: $Version=1
> > Host: localhost:8081
> > User-Agent: Jakarta HTTP Client/1.0
> >
> > 95
> >
> >
> > Why does my command line client (extremely simple, code included, 30
> lines)
> > do use the "PROPFIND" method instead of the POST?
> >
> > Any idea?
> >
> > Thanks a lot,
> >
> > Stan.
> >
> > --=====================_27832260==_
> > Content-Type: text/plain; x-avg-checked=avg-ok-3AA55D59; charset=us-ascii
> > Content-Disposition: attachment; filename="WebDavClient.java"
> > Content-Transfer-Encoding: 8bit
> >
> > /**
> > *
> > *
> > */
> > package com.axone.repository;
> >
> > import java.io.*;
> > import java.net.URI;
> > import java.net.URISyntaxException;
> > import java.net.MalformedURLException;
> >
> > import org.apache.webdav.lib.WebdavResource;
> >
> > import org.apache.commons.httpclient.HttpException;
> > import org.apache.commons.httpclient.HttpStatus;
> > import org.apache.util.HttpURL;
> >
> > /**
> > * This class acts as a facade to specific
> > * implementations of WebDav libraries.
> > * Basic functionalities provided are:
> > * - add a file to the WebDav filesystem.
> > *
> > * NOTE: at first, we implement a flat storage strategy.
> > */
> > public class WebDavClient
> > {
> > private String user = "root";
> > private String password = "root";
> > private String hostPort = "";
> > private String davPath = "";
> >
> > /**
> > * add a file to the repository.
> > */
> > public URI addFile(String path) throws MalformedURLException,
> > HttpException,
> > IOException,
> > URISyntaxException
> > {
> > File file = new File(path);
> > //InputStream stream = new FileInputStream(path);
> > String fileName = file.getName();
> > WebdavResource resource = getResource();
> >
> > if (!file.exists())
> > {
> > throw new IOException("file does not exist: " + file);
> > }
> >
> > //resource.setDebug(8);
> > System.out.println("adding: [" + fileName + "]");
> > //boolean succeeded = resource.putMethod(fileName, "test
> data...\n");
> > boolean succeeded = resource.putMethod(fileName, file);
> > if (!succeeded)
> > {
> > throw new IOException(resource.getStatusMessage());
> > }
> > return new URI(hostPort + davPath + fileName);
> > }
> >
> > private WebdavResource getResource() throws MalformedURLException,
> > HttpException,
> > IOException
> > {
> > HttpURL url = new HttpURL(hostPort + davPath);
> > //HttpURL url = new
> HttpURL("http:://localhost:8086/slide/files/octa/");
> > url.setUserInfo(user, password);
> > return new WebdavResource(url);
> > }
> >
> > public void list() throws Exception
> > {
> > WebdavResource resource = getResource();
> > String[] paths = resource.list();
> >
> > for (int i=0; i<paths.length; i++)
> > {
> > System.out.println("path: " + paths[i]);
> > }
> > }
> >
> > public static void main(String[] args) throws Exception
> > {
> >
> > if (args.length != 3)
> > {
> > System.out.println("Usage: java
> com.axone.repository.WebDavClient davServer davPath documentPath");
> > System.exit(1);
> > }
> > WebDavClient client = new WebDavClient();
> > client.hostPort = args[0];
> > client.davPath = args[1];
> > System.out.println("added: [" + client.addFile(args[2]) +
> "]");
> > //client.list();
> > }
> > }
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003
Re: more debugging info on standalone client that does not
work...whereas the command-line slide client does...
Posted by Ingo Brunberg <ib...@fiz-chemie.de>.
Hello Stan,
the PROPFIND call is made whenever you create a new
WebdavResource. This call collects some info about the resource and
probably its children. In your client, when you try to upload a file,
you call the putMethod() with a path of file.getName(). I guess that
will not work because you are expected to specifiy the full path
starting from the root node.
Hope that helps,
Ingo
> hello,
>
> when I "put" a file using the command line client, here is what I see, at
> the HTTP level (client side).
>
> PUT /slide/files/octa/run.bat HTTP/1.1
> Transfer-Encoding: chunked
> Expect: 100-continue
> Cookie: $Version=1;JSESSIONID=27nd1jad7peet; $Path=/slide; $Domain=localhost
> Host: localhost:8081
> User-Agent: Jakarta HTTP Client/1.0
>
> c1
> @echo off
> set
> CP2=%CLASSPATH%;../lib/webdav.jar;../lib/jaxp.jar;../lib/crimson.jar;../lib/commons-httpclient.jar
> java -classpath %CP2% org.apache.webdav.cmd.Slide %1 %2 %3 %4 %5 %6 %7 %8 %9
>
> 0
>
>
> when I use a java class, built on top of the WebDAV library, I get this:
>
> PROPFIND /slide/files/octa/ HTTP/1.1
> Content-Length: 207
> Content-Type: text/xml; charset=utf-8
> Host: localhost:8081
> Depth: 0
> User-Agent: Jakarta HTTP Client/1.0
>
> <?xml version="1.0" encoding="utf-8" ?><D:propfind
> xmlns:D="DAV:"><D:prop><D:displayname/><D:getcontentlength/><D:getcontenttype/><D:resourcetype/><D:getlastmodified/><D:lockdiscovery/></D:prop></D:propfind>PUT
> / HTTP/1.1
> Transfer-Encoding: chunked
> Expect: 100-continue
> Cookie: $Version=1
> Host: localhost:8081
> User-Agent: Jakarta HTTP Client/1.0
>
> 95
>
>
> Why does my command line client (extremely simple, code included, 30 lines)
> do use the "PROPFIND" method instead of the POST?
>
> Any idea?
>
> Thanks a lot,
>
> Stan.
>
> --=====================_27832260==_
> Content-Type: text/plain; x-avg-checked=avg-ok-3AA55D59; charset=us-ascii
> Content-Disposition: attachment; filename="WebDavClient.java"
> Content-Transfer-Encoding: 8bit
>
> /**
> *
> *
> */
> package com.axone.repository;
>
> import java.io.*;
> import java.net.URI;
> import java.net.URISyntaxException;
> import java.net.MalformedURLException;
>
> import org.apache.webdav.lib.WebdavResource;
>
> import org.apache.commons.httpclient.HttpException;
> import org.apache.commons.httpclient.HttpStatus;
> import org.apache.util.HttpURL;
>
> /**
> * This class acts as a facade to specific
> * implementations of WebDav libraries.
> * Basic functionalities provided are:
> * - add a file to the WebDav filesystem.
> *
> * NOTE: at first, we implement a flat storage strategy.
> */
> public class WebDavClient
> {
> private String user = "root";
> private String password = "root";
> private String hostPort = "";
> private String davPath = "";
>
> /**
> * add a file to the repository.
> */
> public URI addFile(String path) throws MalformedURLException,
> HttpException,
> IOException,
> URISyntaxException
> {
> File file = new File(path);
> //InputStream stream = new FileInputStream(path);
> String fileName = file.getName();
> WebdavResource resource = getResource();
>
> if (!file.exists())
> {
> throw new IOException("file does not exist: " + file);
> }
>
> //resource.setDebug(8);
> System.out.println("adding: [" + fileName + "]");
> //boolean succeeded = resource.putMethod(fileName, "test data...\n");
> boolean succeeded = resource.putMethod(fileName, file);
> if (!succeeded)
> {
> throw new IOException(resource.getStatusMessage());
> }
> return new URI(hostPort + davPath + fileName);
> }
>
> private WebdavResource getResource() throws MalformedURLException,
> HttpException,
> IOException
> {
> HttpURL url = new HttpURL(hostPort + davPath);
> //HttpURL url = new HttpURL("http:://localhost:8086/slide/files/octa/");
> url.setUserInfo(user, password);
> return new WebdavResource(url);
> }
>
> public void list() throws Exception
> {
> WebdavResource resource = getResource();
> String[] paths = resource.list();
>
> for (int i=0; i<paths.length; i++)
> {
> System.out.println("path: " + paths[i]);
> }
> }
>
> public static void main(String[] args) throws Exception
> {
>
> if (args.length != 3)
> {
> System.out.println("Usage: java com.axone.repository.WebDavClient davServer davPath documentPath");
> System.exit(1);
> }
> WebDavClient client = new WebDavClient();
> client.hostPort = args[0];
> client.davPath = args[1];
> System.out.println("added: [" + client.addFile(args[2]) + "]");
> //client.list();
> }
> }
>
Re: more debugging info on standalone client that does not
work...whereas the command-line slide client does...
Posted by Ingo Brunberg <ib...@fiz-chemie.de>.
Hello Stan,
the PROPFIND call is made whenever you create a new
WebdavResource. This call collects some info about the resource and
probably its children. In your client, when you try to upload a file,
you call the putMethod() with a path of file.getName(). I guess that
will not work because you are expected to specifiy the full path
starting from the root node.
Hope that helps,
Ingo
> hello,
>
> when I "put" a file using the command line client, here is what I see, at
> the HTTP level (client side).
>
> PUT /slide/files/octa/run.bat HTTP/1.1
> Transfer-Encoding: chunked
> Expect: 100-continue
> Cookie: $Version=1;JSESSIONID=27nd1jad7peet; $Path=/slide; $Domain=localhost
> Host: localhost:8081
> User-Agent: Jakarta HTTP Client/1.0
>
> c1
> @echo off
> set
> CP2=%CLASSPATH%;../lib/webdav.jar;../lib/jaxp.jar;../lib/crimson.jar;../lib/commons-httpclient.jar
> java -classpath %CP2% org.apache.webdav.cmd.Slide %1 %2 %3 %4 %5 %6 %7 %8 %9
>
> 0
>
>
> when I use a java class, built on top of the WebDAV library, I get this:
>
> PROPFIND /slide/files/octa/ HTTP/1.1
> Content-Length: 207
> Content-Type: text/xml; charset=utf-8
> Host: localhost:8081
> Depth: 0
> User-Agent: Jakarta HTTP Client/1.0
>
> <?xml version="1.0" encoding="utf-8" ?><D:propfind
> xmlns:D="DAV:"><D:prop><D:displayname/><D:getcontentlength/><D:getcontenttype/><D:resourcetype/><D:getlastmodified/><D:lockdiscovery/></D:prop></D:propfind>PUT
> / HTTP/1.1
> Transfer-Encoding: chunked
> Expect: 100-continue
> Cookie: $Version=1
> Host: localhost:8081
> User-Agent: Jakarta HTTP Client/1.0
>
> 95
>
>
> Why does my command line client (extremely simple, code included, 30 lines)
> do use the "PROPFIND" method instead of the POST?
>
> Any idea?
>
> Thanks a lot,
>
> Stan.
>
> --=====================_27832260==_
> Content-Type: text/plain; x-avg-checked=avg-ok-3AA55D59; charset=us-ascii
> Content-Disposition: attachment; filename="WebDavClient.java"
> Content-Transfer-Encoding: 8bit
>
> /**
> *
> *
> */
> package com.axone.repository;
>
> import java.io.*;
> import java.net.URI;
> import java.net.URISyntaxException;
> import java.net.MalformedURLException;
>
> import org.apache.webdav.lib.WebdavResource;
>
> import org.apache.commons.httpclient.HttpException;
> import org.apache.commons.httpclient.HttpStatus;
> import org.apache.util.HttpURL;
>
> /**
> * This class acts as a facade to specific
> * implementations of WebDav libraries.
> * Basic functionalities provided are:
> * - add a file to the WebDav filesystem.
> *
> * NOTE: at first, we implement a flat storage strategy.
> */
> public class WebDavClient
> {
> private String user = "root";
> private String password = "root";
> private String hostPort = "";
> private String davPath = "";
>
> /**
> * add a file to the repository.
> */
> public URI addFile(String path) throws MalformedURLException,
> HttpException,
> IOException,
> URISyntaxException
> {
> File file = new File(path);
> //InputStream stream = new FileInputStream(path);
> String fileName = file.getName();
> WebdavResource resource = getResource();
>
> if (!file.exists())
> {
> throw new IOException("file does not exist: " + file);
> }
>
> //resource.setDebug(8);
> System.out.println("adding: [" + fileName + "]");
> //boolean succeeded = resource.putMethod(fileName, "test data...\n");
> boolean succeeded = resource.putMethod(fileName, file);
> if (!succeeded)
> {
> throw new IOException(resource.getStatusMessage());
> }
> return new URI(hostPort + davPath + fileName);
> }
>
> private WebdavResource getResource() throws MalformedURLException,
> HttpException,
> IOException
> {
> HttpURL url = new HttpURL(hostPort + davPath);
> //HttpURL url = new HttpURL("http:://localhost:8086/slide/files/octa/");
> url.setUserInfo(user, password);
> return new WebdavResource(url);
> }
>
> public void list() throws Exception
> {
> WebdavResource resource = getResource();
> String[] paths = resource.list();
>
> for (int i=0; i<paths.length; i++)
> {
> System.out.println("path: " + paths[i]);
> }
> }
>
> public static void main(String[] args) throws Exception
> {
>
> if (args.length != 3)
> {
> System.out.println("Usage: java com.axone.repository.WebDavClient davServer davPath documentPath");
> System.exit(1);
> }
> WebDavClient client = new WebDavClient();
> client.hostPort = args[0];
> client.davPath = args[1];
> System.out.println("added: [" + client.addFile(args[2]) + "]");
> //client.list();
> }
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org