Why not start from the WebDAV servlet supplied with Tomcat? http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/catalina/src/share/org/ apache/catalina/servlets/WebdavServlet.java
Alternatively took a look at Jakarta Slide. http://jakarta.apache.org/slide/index.html Re-inventing the wheel can be fun if you have the time but if not, these should give you a head start. One final thing to be aware of. MS clients use a different webdav client if you connect using port 80 (that doesn't work with the Tomcat servlet) than if you connect using any other port. As long as you use any other port, MS clients use an implementation that works with the Tomcat webdav servlet. As far as I can tell this is an MS bug. Mark > -----Original Message----- > From: Lukas Mathis [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 18, 2005 5:26 PM > To: [email protected] > Subject: Problem writing Webdav Servlet for Tomcat > > Hi, > > I'm trying to write a Webdav Servlet for Tomcat (based on Tomcat > example code). Basically, I've written a first, very simple version > which simply serves an empty directory. Unfortunately, Windows can't > open it: When I try to open a Web Folder in Windows, it tells me > that it "Cannot connect to the Web server > http://localhost:8080/webdav. The server could not be located, or > may be too busy to respond. Please check your typing or check to > make sure the Web server is available". > > Calling System.out.println() in my Webdav Servlet tells me that it > got a PROPFIND request at path /webdav, but somehow, Windows either > doesn't get an answer or doesn't understand it. > > Here are the relevant parts of my code: > > > (...) > public class WebDavServlet extends HttpServlet { > (...) > protected void service(HttpServletRequest req, > HttpServletResponse resp) > throws ServletException, IOException { > if (method.equals(METHOD_PROPFIND)) { > doPropfind(req, resp); > } > (...) > } > protected void doPropfind(HttpServletRequest req, > HttpServletResponse resp) > throws ServletException, IOException { > resp.setStatus(SC_MULTI_STATUS); > resp.setContentType("text/xml; charset=UTF-8"); > StringBuffer buffer = new StringBuffer(); > buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"); > buffer.append("<multistatus xmlns=\"DAV:\">\n" + > "</multistatus>\n" > ); > java.io.PrintWriter resp_writer = resp.getWriter(); > resp_writer.write(buffer.toString()); > } > (...) > } > > > If anyone could shed any light on this, I would be extremely grateful. > I really am stumped. > > Thanks for your time! > > lukas > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
