You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Torsten Curdt <tc...@apache.org> on 2009/01/04 18:07:21 UTC

simple webdav servlet

I was trying to expose a repository via webdav

    public final class WebdavServlet extends
      org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet {

    	private Repository repository;
	
    	private File repositoryHome = new File("/path/to/repo");
	
    	public Repository getRepository() {
		
    		if (repository == null) {
    			try {
    				repository = new TransientRepository(
    				  "path/to/repository.xml",
    				  repositoryHome.getAbsolutePath()
    				);
    			} catch (IOException e) {
    			    e.printStackTrace();
    			}
    		}
		
    		return repository;
    	}
    }

The servlet and repo seems to start up just fine. But when accessing it at

 http://localhost:8080/webdav/repository/default

(mapped as /webdav/*) all I get is

<?xml version="1.0" encoding="UTF-8"?>
<D:error xmlns:D="DAV:">
<dcr:exception xmlns:dcr="http://www.day.com/jcr/webdav/1.0">
<dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
<dcr:message>webdav</dcr:message></dcr:exception>
</D:error>

In my testcases I never had to create a workspace myself and it just
worked with the following settings:

    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>

    <Workspace name="${wsp.name}">
        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
            <param name="path" value="${wsp.home}"/>
        </FileSystem>
        <PersistenceManager
class="org.apache.jackrabbit.core.state.db.DerbyPersistenceManager">
          <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
          <param name="schemaObjectPrefix" value="${wsp.name}_"/>
        </PersistenceManager>
        <SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
            <param name="path" value="${wsp.home}/index"/>
        </SearchIndex>
    </Workspace>

Any pointers? (I am using 1.5)

cheers
--
Torsten

Re: simple webdav servlet

Posted by Torsten Curdt <tc...@apache.org>.
Ah ... thanks for the pointer!

On Mon, Jan 5, 2009 at 17:41, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On Mon, Jan 5, 2009 at 5:27 PM, Alexander Klimetschek <ak...@day.com> wrote:
>> It seems he is looking for a "webdav" workspace. Looks like the URL
>> mapping you use is breaking it [...]
>
> The SimpleWebdavServlet expects the resource-path-prefix init
> parameter to be set to the path prefix if the servlet is mapped to
> something else than the root URL. Setting it to "/webdav" should fix
> this.
>
> BR,
>
> Jukka Zitting
>

Re: simple webdav servlet

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Mon, Jan 5, 2009 at 5:27 PM, Alexander Klimetschek <ak...@day.com> wrote:
> It seems he is looking for a "webdav" workspace. Looks like the URL
> mapping you use is breaking it [...]

The SimpleWebdavServlet expects the resource-path-prefix init
parameter to be set to the path prefix if the servlet is mapped to
something else than the root URL. Setting it to "/webdav" should fix
this.

BR,

Jukka Zitting

Re: simple webdav servlet

Posted by Alexander Klimetschek <ak...@day.com>.
On Sun, Jan 4, 2009 at 6:07 PM, Torsten Curdt <tc...@apache.org> wrote:
> The servlet and repo seems to start up just fine. But when accessing it at
>
>  http://localhost:8080/webdav/repository/default
>
> (mapped as /webdav/*) all I get is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <D:error xmlns:D="DAV:">
> <dcr:exception xmlns:dcr="http://www.day.com/jcr/webdav/1.0">
> <dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
> <dcr:message>webdav</dcr:message></dcr:exception>
> </D:error>

It seems he is looking for a "webdav" workspace. Looks like the URL
mapping you use is breaking it - someone is probably using the last
part of the URL path as the workspace name, which would be "default"
for the normal "http://localhost:8080/webdav/repository/default" and
"webdav" for your "http://localhost:8080/webdav/*". Not sure if this
is bug, but I think the implementation is in [1] and ought to be
generic.

[1] https://svn.apache.org/viewvc/jackrabbit/tags/1.5.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java?view=markup

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com