Here is "a way" to make any mappings work well with MS....
I include my kludge (code) if anything so the guru's can study it and see
how I made
MS happy with any mapping.... then improve on it and stick it in a future
release of TC
David Delbecq.... you hit the nail on the head and thank you.... else I
would have given up.
My fix... wasnt picking up on overriden service method... and I assumed it
was WebDav
talking, in fact it was the just the standard servlet replying... and so yes
I mistakenly called
Microsoft "RFC pirates and bullies" and thought the TC guys had used an old
spec ;)
(why did that feel good anyway ;)
The code is below..... or rather my kludge is below.
Working with WEB FOLDERS in Microsoft's File Explorer is just magic....
Getting your TC sites into them is as simple as (in IE browser)
FILE -> OPEN ->(click on web folder) -> paste ..../webdav url
Have fun...
========================================
/*
* WebDavServletImpl.java
*
* Created on 23 July 2007
* Microsoft Placebo... and relative path fixer
*/
package kewlstuff.webdav;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.catalina.servlets.WebdavServlet;
/**
*
* @author Johnny Kewl
* @version 1
*/
public class WebDavServletImpl extends WebdavServlet {
//Override service method... makes debugging easier
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
super.service(req,resp);
}
public String getServletInfo() {
return "Microsoft Placebo... and relative path fixer";
}
//Override getRelativePath... which is actually in DefaultServlet
//coz WebdavServlet inherits from DefaultServlet
protected String getRelativePath(HttpServletRequest request) {
//Note.... removed Dispatcher calls... see overriden function
//Its doubtful it will ever be used like that... but
//you can put the code back if you want it...
// extract the desired path directly from the request
// but if it ends in /webdav.... make the path /
String result = request.getPathInfo();
if (result == null) {
result = request.getServletPath();
}
if ((result == null) || (result.equals(""))) {
result = "/";
}
if(result.endsWith("/webdav")) result = "/"; //HERE IT IS... the MOD
return (result);
}
}
/*
AND HERE IT IS.... effectively moves /webdav back to the "root" of the
webapp
this makes Microsoft happy and allows one to make exotic mappings
ie the call 'can' end with /webdav (no trailing slash)
eg:
http://host:port/webapp/webdav
or
http://host:port/webapp/webdav/ (existing method but MS doesnt like it)
for a mapping of /webdav/*
eg:
http://host:port/webapp/get_it_out_of_my_way/webdav
http://host:port/webapp/get_it_out_of_my_way/webdav/ (MS doesnt like but it
works)
for a mapping of /get_it_out_of_my_way/webdav/*
WHAT DOES THIS MEAN?
You can continue to use the /* mapping which kills the welcome page
but otherwise works perfectly
or.... simply end the mapping with "webdav" if you want it not to
take over the root of your web app... or if you have a folder
called webdav already and you need to move it out the way.
BUT there is one little thing....
In MS you can rename, create folders, drag and drop images, delete, copy...
etc etc
BUT if you try open the WEB FOLDER file in say frontpage...
it will try open the page /webdav/index.jsp not /index.jsp
ie it puts an extra "your mapped path in"...
This I can live with because the client is just not very smart in this area
anyway...
For example if you try open it in a text editor... it uses a crazy path
like
C:/documents and settings/user name/http://yada blah
which is enuf to confuse any program anyway....
So what I'm saying is that the user will drag the contents from the web
folder to
a normal folder anyway... then it works fine.
Bottom line.... please include this in the next release of TC... it makes
no diffs
to existing operation... it just allows for more options... albeit with a
few
simple conditions... and it make MS as happy as its going to get.
If anyone wants this bad... let me know, I'll turn it into a lib that one
can include
in their servlet.
Johnny Kewl
*/
========================================
ORIGINAL QUESTION
Hi guys,
Being using FTP, thought I would give WebDav a try, but cant get it working
nicely...
This is the mapping for the webdav servlet, and this I can get working with
IE web folders (ms webdav client).... seems to work nicely.
<servlet-mapping>
<servlet-name>webdav</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
So I thought, nice, but it overrides the default welcome index.jsp page in
the browser... so I tried this.
<servlet-mapping>
<servlet-name>webdav</servlet-name>
<url-pattern>/webdav/*</url-pattern>
</servlet-mapping>
Now the IE browser seems to respond correctly.... ie
http://localhost:8080/webapp will give welcome page
and http://localhost:8080/webapp/webdav/ shows the files IN THE BROWSER
But in MS you have to stick the link in a Web-Folder so that you can
manipulate files, and MS reports this (/webapp/webdav/) as not being a WEB
Folder?
So I'm wondering if this mapping is illegal from the point of view of the
webdav servlet.... or its a problem with MS Web Folders?
Thx....
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]