tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 40160] - Webdav Context path must be /*
Date Fri, 08 Sep 2006 13:42:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40160>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40160





------- Additional Comments From fassev@gmx.de  2006-09-08 13:42 -------
This is actually a Micorosft problem, and it is du to the implementation of the 
MS Client, which requests some information against the root "/", regardles of 
the resource and the real root of WebDAV. To solve this problem, I am using a 
simple Filter to filter the MS WebDAV requests:

/**
 * The webdav interceptor blocks some FrontPage requests and determinate the 
encoding of the underlying request
 *
 */
public class WebdavInterceptor implements Filter {

    public static final String MICROSOFT_PROTOCOL_AGENT = 
        "Microsoft Data Access Internet Publishing Provider Protocol Discovery";

    /** Creates a new instance of LoginInterceptor */
    public WebdavInterceptor()
    {
    }

    public void init(javax.servlet.FilterConfig filterConfig) throws 
javax.servlet.ServletException
    {
    }

    public void destroy()
    {
    }

    /** Filter some invalid calls from the Microsoft WebDAV clients (Windows 
2000, Windows XP and Office 2003) */
    public void doFilter(ServletRequest servletRequest, ServletResponse 
servletResponse, 
        FilterChain filterChain) throws IOException, ServletException
    {
        HttpServletRequest request = (HttpServletRequest)servletRequest;
        String path = request.getServletPath();
        if (path != null) {
            if (path.endsWith("/index.jsp")) {
                // a very strange microsoft webdav handling... (because of the 
front page extensions!)
                // Microsoft (protocol discoverer) is asking the root of the 
server
                // whether it can handles a WebDAV, so we have to catch it 
here. Unfortunately we can't
                // redirect the root URL ("/") to a servlet, because we will 
intercept any other
                // path handling...
                String agent = request.getHeader("user-agent");
                if (MICROSOFT_PROTOCOL_AGENT.equals(agent)) {
                    HttpServletResponse response = (HttpServletResponse)
servletResponse;
                    response.addHeader("DAV", "1,2");

                    response.addHeader("Allow", "OPTIONS, TRACE, PROPFIND");
                    response.addHeader("MS-AUTHOR-VIA", "DAV");
                    return;
                }
            }
            // block, front page and m$ office extensions requests...
            if (path.startsWith("/_vti") || path.startsWith("/MSOffice")) {
                ((HttpServletResponse)servletResponse).setStatus
(HttpServletResponse.SC_NOT_FOUND);
                return;
            }
        }

        request.setCharacterEncoding(WebdavServlet.getEnconding(request));
        filterChain.doFilter(servletRequest, servletResponse);
    }

}

Please note, that the root "/" is mapped to "/index.jsp", this is the standard 
welcome file whithin my container. Thus the filter is mapped to:
  <filter-mapping>
    <filter-name>webdavFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>

and also to the WebDAV Servlet:
  <filter-mapping>
    <filter-name>webdavFilter</filter-name>
    <servlet-name>webdav</servlet-name>
  </filter-mapping>

The WebDAV servket should map additionaly the following paths:
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/_vti_inf.html</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/_vti_bin/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/MSOffice/*</url-pattern>
  </servlet-mapping>


I hope, this helps you. My WebDAV root is for instance "/webdav/*", and it 
works within a container togther with a web application.

Regards
Peter


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message