I guess I misread your comments a little bit. The /main threw me off track.
Anyway, I think you can set up a filter to work on the entire site using the /* filter-mapping. You can choose what to process in there. And then your other mappings will still be valid and won't be taken over by a servlet-maping set to /*. I haven't tried this, but it should work, in theory. Jake At 10:25 PM 7/17/2002 +0100, you wrote: >Jake, > >I am not quite sure what you mean. Maybe I should furnish you with some more >information. I have a root context path in server.xml for the pointing >to the directory where WEB-INF/ is located and various other resources: > ><Context path="" docBase="/home/mark/etc/etc/" debug="0"/> > >Of course, this will change at deployment time. "main" is just some text I >have added to map the URL to my servlet: > ><servlet-mapping> > <servlet-name>mainservlet</servlet-name> > <url-pattern>/main/*</url-pattern> ></servlet-mapping> > >What I would like to do is have mappings like this: > ><servlet-mapping> > <servlet-name>mainservlet</servlet-name> > <url-pattern>/</url-pattern> ></servlet-mapping> > ><servlet-mapping> > <servlet-name>mainservlet</servlet-name> > <url-pattern>*.html</url-pattern> ></servlet-mapping> > ><servlet-mapping> > <servlet-name>mainservlet</servlet-name> > <url-pattern>*.htm</url-pattern> ></servlet-mapping> > >where the URLs www.domainname.com/ (e.g. posting a form), >www.domainname.com/index.html, and www.domainname.com/xyz.htm cause my >servlet to receive the request, whilst >www.domainname.com/image.jpeg is resolved by the "default servlet". > >However, the 1st of the mappings above seems to be invalid and substitutes >such as: <url-pattern>/*</url-pattern> result in my servlet receiving all >requests to the domain. Please, let me know me if there is any other info you >need. I can't quite reconcile your comments with my difficulties at the >moment! > > >Cheers, >Mark >(PS I would like to solve this if possible before considering filters) > > > > > >On Wednesday 17 July 2002 9:33 pm, Jacob Kjome wrote: > > Hello Mark, > > > > What you have done will only affect servlets inside your context at > > the location: > > www.domainname.com/main/ > > > > What you want to do is to define your context as the root context: > > > > <Context path="" docBase="main" debug="0"/> > > > > Note that if not defined, Tomcat defaults the root context to a > > directory inside webapps named "ROOT". > > > > Now you can access your app via: > > www.domainname.com/ > > > > And all the configuration that you have done such as mapping *.html to > > your servlet will work. > > > > BTW, you can also use a filter instead of a servlet. > > > > Jake > > > > > > > > > > > Wednesday, July 17, 2002, 12:44:26 PM, you wrote: > > > > MB> Hi, > > > > MB> I am using Tomcat 4.0. The problem I am having is that I can't get the > > root MB> context relative to my web site, as in the format > > www.domainname.com/, to MB> point to my own servlet AND still use the > > "default servlet" to handle file MB> extensions which my servlet does not > > cater for. I either have to add some MB> text to the URLs I use as in the > > format www.domainname.com/main/ or I have to MB> take over all the > > responsibilities of the default servlet myself. > > > > MB> The latter is obviously not what I would choose, but neither do I want > > MB> someone to have to type www.domainname.com/main/, and it seems to me > > the only MB> other option is to use welcome files. Unfortunately, this > > seems to require a MB> file such as index.html but I want the first contact > > with my web site to be MB> through my servlet so I can establish whether > > the user has cookies switched MB> on and so I can dynamically customise the > > first page made visible. > > > > MB> I have tried mappings such as the following in my web.xml, to no avail: > > > > MB> <servlet-name>mainservlet</servlet-name> > > MB> <url-pattern>*.html</url-pattern> > > > > MB> <servlet-name>mainservlet</servlet-name> > > MB> <url-pattern>*.htm</url-pattern> > > > > MB> Maybe I have missed some documentation somewhere, but I really would > > MB> appreciate some help. > > > > MB> Thanks in advance, > > MB> Mark > > > > MB> -- > > MB> To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> MB> For additional > > commands, e-mail: <mailto:[EMAIL PROTECTED]>