You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "John C. Dale" <jc...@downinthedesert.com> on 2006/02/27 17:12:02 UTC

WEBDAV for Tomcat 5.0.28

I have a static website deployed in 5.0.28 and wish to access/maintain it
using the lightweight DAV servlet that ships with this version of Tomcat
(Slide is overkill for my purposes).
 
    <servlet>
        <servlet-name>dav</servlet-name>
 
 
<servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
 
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
 
        <init-param>
            <param-name>readonly</param-name>
            <param-value>false</param-value>
        </init-param>
 
    </servlet>
 
    <servlet-mapping>
        <servlet-name>dav</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
 
I am able to connect to the webshare using Microsoft Network Neighborhood.
I authenticate and modify files in the static web application with no
issues.
 
However, when I access the webapp via the web browser, I get a directory
listing (this is not behavior consistent with my expectations).
 
What is the recommended deployment of the static site and webdav servlet
such that direct access to the files does not go through the servlet, and
webdav requests do?
 
Best Wishes,
 
John Dale

RE: WEBDAV for Tomcat 5.0.28

Posted by "John C. Dale" <jc...@downinthedesert.com>.
Thank you for the lead, but I think this is actually the source of my issue
even in later versions of the beautifully lightweight webdav release...

This is from the <tomcat-5.5.15 installdir>webapps/webdav/WEB-INF/web.xml
file:

<!-- Using /* as the mapping ensures that jasper, welcome files etc are
       over-ridden and all requests are processed by the webdav servlet.
       This also overcomes a number of issues with some webdav clients
       (including MS Webfolders) that do not respond correctly to the
       redirects (302) that result from using a mapping of / -->
<servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

But if I use "/*" as the servlet mapping, and if all requests are processed
by the webdav servlet, the directory is not accessible from a web browser
since the "/" request to my web application returns a directory listing
instead of returning the welcome file!

What this suggest to me is that the default webdav client does not work for
the biggest potential market for web hosting customers, i.e., windows users.
Since Microsoft's market dominance is reality (so reality bites), the webdav
servlet is not feasible as it stands...

...unless...

There is a workaround for this.  I would prefer not to give my hosting
clients the following answer:

"Get another WebDAV client..."

This means that I (and anyone else using Tomcat for hosting) lose
marketshare to Microsoft-compatible solutions since users tend to gravitate
to what is quickest and easiest.

To thwart the buffer overflow thread, I want to run pure Java web hosting.
Tomcat, IMO, is my best alternative save this one issue, and (duh) any help
would be much appreciated.

JCD

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Monday, February 27, 2006 2:44 PM
To: Tomcat Users List
Subject: Re: WEBDAV for Tomcat 5.0.28


John C. Dale wrote:
> What is the recommended deployment of the static site and webdav 
> servlet such that direct access to the files does not go through the 
> servlet, and webdav requests do?

You'll need the webdav servlet from 5.5.x You can get this here:
http://www.apache.org/dist/java-repository/tomcat/jars/servlets-webdav-5.5.1
5.jar

The following is from:
http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/webapps/webdav/inde
x.html

To add remote authoring to your web application, you need to make the
following changes:

    * Add the webDAV servlet to your web application. See the web
application deployment descriptor for an example. Don't forget to make it
read/write.
    * Add a servlet mapping for the webDAV servlet with a url pattern of
"/webdav/*" to your web.xml.
    * Add an appropriate security constraint to prevent unauthorised changes
to your web application.
    * You can then edit your web application using a webDAV client using a
url like http://host:port/webapp/webdav


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


[UPDATE - FOUND WORKAROUND FOR LINUX TOMCAT WEBDAV DEPLOYMENTS] WEBDAV for Tomcat 5.0.28

Posted by "John C. Dale" <jc...@downinthedesert.com>.
I found a workaround.

I wasn't able to use the DAV servlet that ships with Tomcat 5.5.15 and
reverted to the standard 5.0.28 servlet.  I was getting the following error
that I believe was causing an issue with connections from windows web
folders (more below on the error I was receiving on the windows side).

----- ERROR BEGIN -----

java.lang.NoSuchFieldError: resources
	at
org.apache.catalina.servlets.WebdavServlet.doPropfind(WebdavServlet.java:452
)
	at
org.apache.catalina.servlets.WebdavServlet.service(WebdavServlet.java:272)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:237)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:540)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137
)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118
)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:705)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:683)
	at java.lang.Thread.run(Thread.java:534)

----- ERROR END -----

Now, on to the workaround for Linux...

I'm using a linux hosting environment with a recent kernel, meaning that I
can do soft links from directory to directory using the mount command.

EX:// mount --bind existing-dir-name soft-link-name

NOTE:  You have to create the directory soft-link-name before doing the
mount.

I have a static website www that I want to access via WebDAV.  I setup a
separate webapp called www_dav with the standard DAV (5.0.28) servlet
deployed/configured within.  Then, within www_dav I setup a soft link
pointing to the www webapp containing the static files.  Then, when
accessing the www_dav context, all requests are mapped to the servlet using
slash splat (/*), and the WebDAV servlet is invoked.  When accessing the www
context, static files are served-up via Tomcat bypassing the WebDAV servlet.

For thousands of hosting customers, this is a maintenance nightmare, but it
is the best I we can do until if/when the above issue is resolved.  I assume
that I need a 'resources' parameter defined in the Servlet deployment
descriptor (see error above), but have no idea what to set it to, and have
no idea if this is the real reason I get the following windows XP WebDAV
connection error (I just know the error goes away with the above
configuration).

"the folder you entered does not appear to be valid"

By the way, kudos to the Microsoft programming team for 1) releasing a
WebDAV client that doesn't appear to work properly with industry-standard
forwarding behavior (see previous email re: note in default webdav web.xml
comments) and 2) providing me with an incredibly bland, non-informative
error message.

Bear Down,

JCD


-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Monday, February 27, 2006 2:44 PM
To: Tomcat Users List
Subject: Re: WEBDAV for Tomcat 5.0.28


John C. Dale wrote:
> What is the recommended deployment of the static site and webdav 
> servlet such that direct access to the files does not go through the 
> servlet, and webdav requests do?

You'll need the webdav servlet from 5.5.x You can get this here:
http://www.apache.org/dist/java-repository/tomcat/jars/servlets-webdav-5.5.1
5.jar

The following is from:
http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/webapps/webdav/inde
x.html

To add remote authoring to your web application, you need to make the
following changes:

    * Add the webDAV servlet to your web application. See the web
application deployment descriptor for an example. Don't forget to make it
read/write.
    * Add a servlet mapping for the webDAV servlet with a url pattern of
"/webdav/*" to your web.xml.
    * Add an appropriate security constraint to prevent unauthorised changes
to your web application.
    * You can then edit your web application using a webDAV client using a
url like http://host:port/webapp/webdav


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: WEBDAV for Tomcat 5.0.28

Posted by Mark Thomas <ma...@apache.org>.
John C. Dale wrote:
> What is the recommended deployment of the static site and webdav servlet
> such that direct access to the files does not go through the servlet, and
> webdav requests do?

You'll need the webdav servlet from 5.5.x You can get this here:
http://www.apache.org/dist/java-repository/tomcat/jars/servlets-webdav-5.5.15.jar

The following is from:
http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/webapps/webdav/index.html

To add remote authoring to your web application, you need to make the
following changes:

    * Add the webDAV servlet to your web application. See the web
application deployment descriptor for an example. Don't forget to make
it read/write.
    * Add a servlet mapping for the webDAV servlet with a url pattern
of "/webdav/*" to your web.xml.
    * Add an appropriate security constraint to prevent unauthorised
changes to your web application.
    * You can then edit your web application using a webDAV client
using a url like http://host:port/webapp/webdav


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org