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 Chris O'Connell <CO...@centerpost.com> on 2004/11/20 01:14:25 UTC

more newbie...

I'm trying to do some basic stuff to just get my hands around slide and writing a client.  I have Slide running on my tomcat 4.1 server.  I was able to use the packaged command line Slide client to create a node as user root (/slide/files/test).  I then used the client to put a file (test.txt) into that new node.  I can use my browser to go to the node and I see my file.

So, I tried to use the WebdavResource class to do something similar.  I use the following code, and I get a failure message.  My Tomcal log tells me:  

http2112-Processor1, 19-Nov-2004 18:04:13, root, PUT, 405 "Method Not Allowed", 0 ms, /files/test/

I don't get it.  Why can I use the command line app to put a file, but not the WebdavResource?  Thanks for any help you can provide.

Chris

<<snip...
			HttpURL myMachineUrl = new HttpURL("http://localhost:2112/slide/files/test/");
			myMachineUrl.setUserinfo("root", "root");
			UsernamePasswordCredentials cred = new UsernamePasswordCredentials();
			cred.setUserName("root");
			cred.setPassword("root");
			WebdavResource davResource = new WebdavResource(myMachineUrl);
			davResource.setCredentials(cred);
			
			if (davResource == null){
				throw new Exception("davResource is null.  can't continue");
				
			}
			
			Enumeration enum = davResource.getAllowedMethods();
			
			WebdavResources resources = davResource.getChildResources();
			
			Enumeration capabilities = davResource.getDavCapabilities();
			
			File testFile = new File("C:\\odbcconf.log");
			
			boolean success = davResource.putMethod(testFile);
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: more newbie...

Posted by James Mason <ma...@apache.org>.
It looks like you're trying to overwrite a collection with a file. That
should fail.

-James

On Fri, 2004-11-19 at 18:14 -0600, Chris O'Connell wrote:
> I'm trying to do some basic stuff to just get my hands around slide and writing a client.  I have Slide running on my tomcat 4.1 server.  I was able to use the packaged command line Slide client to create a node as user root (/slide/files/test).  I then used the client to put a file (test.txt) into that new node.  I can use my browser to go to the node and I see my file.
> 
> So, I tried to use the WebdavResource class to do something similar.  I use the following code, and I get a failure message.  My Tomcal log tells me:  
> 
> http2112-Processor1, 19-Nov-2004 18:04:13, root, PUT, 405 "Method Not Allowed", 0 ms, /files/test/
> 
> I don't get it.  Why can I use the command line app to put a file, but not the WebdavResource?  Thanks for any help you can provide.
> 
> Chris
> 
> <<snip...
> 			HttpURL myMachineUrl = new HttpURL("http://localhost:2112/slide/files/test/");
> 			myMachineUrl.setUserinfo("root", "root");
> 			UsernamePasswordCredentials cred = new UsernamePasswordCredentials();
> 			cred.setUserName("root");
> 			cred.setPassword("root");
> 			WebdavResource davResource = new WebdavResource(myMachineUrl);
> 			davResource.setCredentials(cred);
> 			
> 			if (davResource == null){
> 				throw new Exception("davResource is null.  can't continue");
> 				
> 			}
> 			
> 			Enumeration enum = davResource.getAllowedMethods();
> 			
> 			WebdavResources resources = davResource.getChildResources();
> 			
> 			Enumeration capabilities = davResource.getDavCapabilities();
> 			
> 			File testFile = new File("C:\\odbcconf.log");
> 			
> 			boolean success = davResource.putMethod(testFile);
> >>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


RE: more newbie...

Posted by Jason McElravy <jm...@nuventive.com>.
Chris,

	I ran into similar issues when I first started experimenting
with slide.

Try replacing:

boolean success = davResource.putMethod(testFile);

with:

boolean success =
davResource.putMethod(davResource.getPath()+"/"+testFile.getName(),
testFile.getContents());

I know that's not an explanation of why your method doesn't work as
expected but its always good to get something working.

Jason
-----Original Message-----
From: Chris O'Connell [mailto:COConnell@centerpost.com] 
Sent: Friday, November 19, 2004 7:14 PM
To: Slide Users Mailing List
Subject: more newbie...

I'm trying to do some basic stuff to just get my hands around slide and
writing a client.  I have Slide running on my tomcat 4.1 server.  I was
able to use the packaged command line Slide client to create a node as
user root (/slide/files/test).  I then used the client to put a file
(test.txt) into that new node.  I can use my browser to go to the node
and I see my file.

So, I tried to use the WebdavResource class to do something similar.  I
use the following code, and I get a failure message.  My Tomcal log
tells me:  

http2112-Processor1, 19-Nov-2004 18:04:13, root, PUT, 405 "Method Not
Allowed", 0 ms, /files/test/

I don't get it.  Why can I use the command line app to put a file, but
not the WebdavResource?  Thanks for any help you can provide.

Chris

<<snip...
			HttpURL myMachineUrl = new
HttpURL("http://localhost:2112/slide/files/test/");
			myMachineUrl.setUserinfo("root", "root");
			UsernamePasswordCredentials cred = new
UsernamePasswordCredentials();
			cred.setUserName("root");
			cred.setPassword("root");
			WebdavResource davResource = new
WebdavResource(myMachineUrl);
			davResource.setCredentials(cred);
			
			if (davResource == null){
				throw new Exception("davResource is
null.  can't continue");
				
			}
			
			Enumeration enum =
davResource.getAllowedMethods();
			
			WebdavResources resources =
davResource.getChildResources();
			
			Enumeration capabilities =
davResource.getDavCapabilities();
			
			File testFile = new File("C:\\odbcconf.log");
			
			boolean success =
davResource.putMethod(testFile);
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org