Specifying '/' in a servlet mapping makes your servlet the "default servlet". This overrides the default "default servlet" that Tomcat provides, which is the one that serves static content and directory listings. This means that it is up to your servlet to provide static file serving functionality. This is why you aren't seeing static files served.
Cheers, Larry > -----Original Message----- > From: Mark Biciunas [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 25, 2002 3:25 PM > To: Tomcat Users List > Subject: Re: static gifs and tomcat > > > Hi Larry, > > Following is a section from my server.xml, used on Tomcat > 3.2.2. Everything > else in the file is untouched save that I am listening on port 80. > > <Host name="localhost"> > <Context path="/" > docbase="webapps/myservlet" > crossContext-"false" > debug="9" > reloadable="true"> > </Context> > </Host> > > > The following is the web.xml file used - again from Tomcat 3.2.2. > > <web-app> > <servlet> > <servlet-name>myservlet</servlet-name> > <servlet-class>myservlet.MyServlet</servlet-class> > </servlet> > <servlet-mapping> > <servlet-name>myservlet</servlet-name> > <url-pattern>/</url-pattern> > </servlet-mapping> > </web-app> > > As you can see, virtual hosting is in place as "localhost" > and there are no > paths in either the context or the url-pattern. If you talk a simple > servlet and implement it like this, you should see the page > served to your > browser (so you know the servlet is firing) but you should not see any > images. If you add a path to web.xml and access the servlet, > you should see > everything work properly and see the images. If you remove > the virtual host > and don't add any path, you should see everything work > properly and see the > images. > > Please do try this - it should be easy to set up and let me know what > results you get. I am curious to know if you or anyone else > can recreate > the problem. > > Thanks; > > Mark > > > > ----- Original Message ----- > From: "Larry Isaacs" <[EMAIL PROTECTED]> > To: "'Tomcat Users List'" <[EMAIL PROTECTED]> > Sent: Friday, January 25, 2002 2:31 PM > Subject: RE: static gifs and tomcat > > > > At this point I would be guessing at what you actually have > > as far as config files and web.xmls. If you can supply a > > simplified test case, I'll try to find the time to give it > > a try. > > > > Cheers, > > Larry > > > > > -----Original Message----- > > > From: Mark Biciunas [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, January 25, 2002 2:04 PM > > > To: Tomcat Users List > > > Subject: Re: static gifs and tomcat > > > > > > > > > Hi Larry, > > > > > > I am running Tomcat 3.2.2 in standalone mode and it does > > > support virtual > > > hosts and the virtual hosting is working - I am able to > > > specify different > > > domains and have them sent to the proper servlets. I also > > > have 4.x running > > > on another set of servers and set up virtual hosts there as > > > well. Again, > > > the different domains are serving to different servlets > as specified. > > > Problem is that while I see the html for the page on my > > > browser, I can't get > > > any images to show up! > > > > > > If I include a path in the web.xml file, ie /foo, then I can > > > access the > > > servlet as www.mydomain/foo and see the servlet and > > > everything correctly. I > > > do not want to do this though. I want my users to access the > > > servlet as > > > www.mydomain only. When I remove the paths from servlet.xml > > > and web.xml, > > > that is where the problem starts. As near as I can tell, > > > both 3.2x and 4.x > > > have the same problem. > > > > > > My guess is there is something I have done wrong here - but I > > > don't know > > > what. Any suggestions? > > > > > > Thanks; > > > > > > Mark > > > > > > > > > ----- Original Message ----- > > > From: "Larry Isaacs" <[EMAIL PROTECTED]> > > > To: "'Tomcat Users List'" <[EMAIL PROTECTED]> > > > Sent: Friday, January 25, 2002 8:42 AM > > > Subject: RE: static gifs and tomcat > > > > > > > > > > Hi Mark, > > > > > > > > An earlier e-mail mentioned using Tomcat 3.2.2 standalone. > > > I believe > > > > for Tomcat 3.x, the standalone HTTP service doesn't > > > currently support > > > > virtual hosts. Requests on the HTTP port (8080 by default) > > > always go > > > > to the default host. Virtual hosts are useful when > connecting to an > > > > external web server, primarily Apache. > > > > > > > > I haven't tried it, but from I can glean from the > > > server.xml, Tomcat 4.x > > > > does support virtual hosts in stand-alone. > > > > > > > > Cheers, > > > > Larry > > > > > > > > > > > > > -----Original Message----- > > > > > From: Mark Biciunas [mailto:[EMAIL PROTECTED]] > > > > > Sent: Thursday, January 24, 2002 6:41 PM > > > > > To: Tomcat Users List > > > > > Subject: static gifs and tomcat > > > > > > > > > > > > > > > What happens when virtual hosting is set up in server.xml - > > > > > using <host > > > > > name="foo">? The reason I am asking is that I am loosing all > > > > > access to > > > > > static data in my application (primarily gifs). The path > > > > > defined in the > > > > > context is "/" and the url-pattern in the web.xml > file is also /. > > > > > > > > > > If I change the url-pattern to anything (ie: /foo), then the > > > > > application > > > > > finds the gifs but now the url to access the > application becomes > > > > > www.myapp.com/foo. (this is no good). Of course, if I > > > > > remove the <Host... > > > > > component from the server.xml file, then everything works > > > > > fine (but now I > > > > > have lost virtual hosting). > > > > > > > > > > When I look at what is happening on the server, I see that > > > > > when no path is > > > > > specified, the doGet method is receiving and trying to deal > > > > > with requests > > > > > for the gifs. If I use /foo, then no requests for gifs > > > come into the > > > > > servlet and everything works. > > > > > > > > > > It looks like the virtual hosting is messing up my ability to > > > > > find files. > > > > > Don't know why this is and I have not been able to find a way > > > > > to solve the > > > > > problem. Any ideas, thoughts or even words of > > > encouragement would be > > > > > greatly appreciated. > > > > > > > > > > Thanks; > > > > > > > > > > Mark > > > > > > > > > > > > > > > -- > > > > > To unsubscribe: > > > <mailto:[EMAIL PROTECTED]> > > > > > For additional commands: > > > <mailto:[EMAIL PROTECTED]> > > > > > Troubles with the list: > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > -- > > > > To unsubscribe: > > > <mailto:[EMAIL PROTECTED]> > > > > For additional commands: > > > <mailto:[EMAIL PROTECTED]> > > > > Troubles with the list: > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > -- > > > To unsubscribe: > <mailto:[EMAIL PROTECTED]> > > > For additional commands: > <mailto:[EMAIL PROTECTED]> > > > Troubles with the list: > <mailto:[EMAIL PROTECTED]> > > > > > > > -- > > To unsubscribe: > <mailto:[EMAIL PROTECTED]> > > For additional commands: > <mailto:[EMAIL PROTECTED]> > > Troubles with the list: > <mailto:[EMAIL PROTECTED]> > > > > > -- > To unsubscribe: <mailto:[EMAIL PROTECTED]> > For additional commands: <mailto:[EMAIL PROTECTED]> > Troubles with the list: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
