jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arne v.Irmer" <Arne.vonIr...@tu-dortmund.de>
Subject Re: WebDAV-enabled Root-Folder
Date Wed, 03 Jun 2009 15:03:31 GMT
Hi Charly,
that was a perfect hint! Now everything works perfectly.

For anyone who wants to build a server with a webdav-enabled Root-Folder (i.e. http://localhost:8080
here is a small cooking recipe:
Normally the jackrabbit-webdav servlet can be reached at http://localhost:8080/jackrabbit-webapp/repository/default/

We have to remove three parts from that URL.
1) "jackrabbit-webapp"
To remove "jackrabbit-webapp" from the URL rename "jackrabbit-webapp.war" to "ROOT.war". This
will cause the Servlet-Container to start the URL of all servlets in "ROOT.war" at "/".
Be sure that not other ROOT.war is in the Servlet-Container. In JBoss 4.x.x the ROOT.war resides
in server/deploy/jboss-web.deployer 

2) "repository"
To remove "repository" from the URL open the web.xml in the ROOT.war (aka jackrabbit-webapp.war)
and replace all "/repository" with "/" 

3) "default" 
To remove "repository" from the URL build the following class and put it in the classpath
of your servlet-container:

package my.package;
import javax.jcr.Repository;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;

import org.apache.jackrabbit.j2ee.SimpleWebdavServlet;
import org.apache.jackrabbit.webdav.simple.LocatorFactoryImpl;

public class MyWebdavServlet extends SimpleWebdavServlet {
	private static final long serialVersionUID = 1L;

	public void init() throws ServletException {
		try {
			final InitialContext ctx = new InitialContext();
			final Repository repository = (Repository) ctx.lookup("java:jcr/local");
		} catch (NamingException e) {

		// Use LocatorFactoryImpl instead of LocatorFactoryImplEx:
		// paths don't include workspace so no "/default" at start.
		setLocatorFactory(new LocatorFactoryImpl(getPathPrefix()));

After that open the web.xml in the ROOT.war (aka jackrabbit-webapp.war) and replace "org.apache.jackrabbit.j2ee.SimpleWebdavServlet"
with your servlet-class (here it would be my.package.MyWebdavServlet)

That's it

View raw message