Re: A couple of questions
The Servlet Spec doesn't require a /servlet/ mapping, but that's what everyone is used to, so I think the Tomcat developers put it in as a default. In the server.xml file there is a RequestInterceptor that handles requests to /servlet/: (server.xml) I believe this is how requests to /examples/servlet/HelloWorldExample are getting mapped to /WEB-INF/classes/HelloWorldExample.class. For a deeper explanation, you need to look at the code in org.apache.tomcat.request.InvokerInterceptor. --jeff - Original Message - From: "Lu, Spencer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, April 13, 2001 11:37 AM Subject: RE: A couple of questions > OK, I have just read the Servlet Specification 2.2, and it does not answer > my first question, which was: > > When I go to the Servlet Examples page > (http://localhost:8080/examples/servlets/index.html), there is a link that > executes the Hello World servlet. This link is > http://localhost:8080/examples/servlet/HelloWorldExample. How does Tomcat > know that when it sees "/examples/servlet/" in the URL, it is supposed to > look in the examples/WEB-INF/classes directory for the > HelloWorldExample.class file? I haven't been able to find anything in the > server.xml or web.xml files that shows how this is configured. > > I see no servlet mappings in any of the configuration files that maps a > servlet to "/examples/servlet/HelloWorldExample". > > Please tell me how this is set up. > > Thanks, > Spencer > > -Original Message- > From: Filip Hanik [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 7:37 PM > To: [EMAIL PROTECTED] > Subject: RE: A couple of questions > > > first things first, > you will have 90% of your questions answered by reading the servlet > specification from Sun. > this answers question 1 for you > > > 2) Would it be possible for me to place my application in a completely > > separate directory tree and not in a war file? Or does it have to be in a > > war file in the webapps directory? > > yes, you will just have to setup classpaths etc properly for servlets and > other classes. > The server.xml file allows you to configure other contexts outside of the > webapps directory. > > Filip > > > > ~ > Namaste - I bow to the divine in you > ~ > Filip Hanik > Software Architect > [EMAIL PROTECTED] > www.filip.net > > > -Original Message- > > From: Lu, Spencer [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, April 11, 2001 4:29 PM > > To: '[EMAIL PROTECTED]' > > Subject: A couple of questions > > > > > > Hi, > > > > I've recently installed Tomcat 3.2.1 (win32) on my computer. I'm > > trying to > > understand how certain things are configured, and I have a couple of > > questions: > > > > 1) When I go to the Servlet Examples page > > (http://localhost:8080/examples/servlets/index.html), there is a link that > > executes the Hello World servlet. This link is > > http://localhost:8080/examples/servlet/HelloWorldExample. How does Tomcat > > know that when it sees "/examples/servlet/" in the URL, it is supposed to > > look in the examples/WEB-INF/classes directory for the > > HelloWorldExample.class file? I haven't been able to find anything in the > > server.xml or web.xml files that shows how this is configured. > > > > 2) Would it be possible for me to place my application in a completely > > separate directory tree and not in a war file? Or does it have to be in a > > war file in the webapps directory? > > > > Thanks for your help, > > Spencer > > > > >
RE: A couple of questions
read again, this time look for /servlet/* and the word "context" it *is* all there > -Original Message- > From: Lu, Spencer [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 13, 2001 7:38 PM > To: '[EMAIL PROTECTED]' > Subject: RE: A couple of questions > > > OK, I have just read the Servlet Specification 2.2, and it does not answer > my first question, which was: > > When I go to the Servlet Examples page > (http://localhost:8080/examples/servlets/index.html), there is a link that > executes the Hello World servlet. This link is > http://localhost:8080/examples/servlet/HelloWorldExample. How does Tomcat > know that when it sees "/examples/servlet/" in the URL, it is supposed to > look in the examples/WEB-INF/classes directory for the > HelloWorldExample.class file? I haven't been able to find anything in the > server.xml or web.xml files that shows how this is configured. > > I see no servlet mappings in any of the configuration files that maps a > servlet to "/examples/servlet/HelloWorldExample". > > Please tell me how this is set up. > > Thanks, > Spencer > > -Original Message----- > From: Filip Hanik [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 7:37 PM > To: [EMAIL PROTECTED] > Subject: RE: A couple of questions > > > first things first, > you will have 90% of your questions answered by reading the servlet > specification from Sun. > this answers question 1 for you > > > 2) Would it be possible for me to place my application in a completely > > separate directory tree and not in a war file? Or does it have > to be in a > > war file in the webapps directory? > > yes, you will just have to setup classpaths etc properly for servlets and > other classes. > The server.xml file allows you to configure other contexts outside of the > webapps directory. > > Filip > > > > ~ > Namaste - I bow to the divine in you > ~ > Filip Hanik > Software Architect > [EMAIL PROTECTED] > www.filip.net > > > -Original Message- > > From: Lu, Spencer [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, April 11, 2001 4:29 PM > > To: '[EMAIL PROTECTED]' > > Subject: A couple of questions > > > > > > Hi, > > > > I've recently installed Tomcat 3.2.1 (win32) on my computer. I'm > > trying to > > understand how certain things are configured, and I have a couple of > > questions: > > > > 1) When I go to the Servlet Examples page > > (http://localhost:8080/examples/servlets/index.html), there is > a link that > > executes the Hello World servlet. This link is > > http://localhost:8080/examples/servlet/HelloWorldExample. How > does Tomcat > > know that when it sees "/examples/servlet/" in the URL, it is > supposed to > > look in the examples/WEB-INF/classes directory for the > > HelloWorldExample.class file? I haven't been able to find > anything in the > > server.xml or web.xml files that shows how this is configured. > > > > 2) Would it be possible for me to place my application in a completely > > separate directory tree and not in a war file? Or does it have > to be in a > > war file in the webapps directory? > > > > Thanks for your help, > > Spencer > > > >
Re: A couple of questions
"Lu, Spencer" wrote: > OK, I have just read the Servlet Specification 2.2, and it does not answer > my first question, which was: > > When I go to the Servlet Examples page > (http://localhost:8080/examples/servlets/index.html), there is a link that > executes the Hello World servlet. This link is > http://localhost:8080/examples/servlet/HelloWorldExample. How does Tomcat > know that when it sees "/examples/servlet/" in the URL, it is supposed to > look in the examples/WEB-INF/classes directory for the > HelloWorldExample.class file? I haven't been able to find anything in the > server.xml or web.xml files that shows how this is configured. > > I see no servlet mappings in any of the configuration files that maps a > servlet to "/examples/servlet/HelloWorldExample". > > Please tell me how this is set up. > > Thanks, > Spencer > [...] Hi :-) with jakarta-tomcat-3.2.1 and jakarta-tomcat-4.0-b(1/2/3), I find the following in conf/server.xml: ... ... the above defines a webapp/ServletContext->"/examples" for accessing HelloWorldExample.class, we don't need to define Servlet mapping if: -HelloWorldExample.class is in WEB-INF/classes - we only want to use the following to access it: http://localhost:8080/examples/servlet/HelloWorldExample Bo Apr.13, 2001
RE: A couple of questions
OK, I have just read the Servlet Specification 2.2, and it does not answer my first question, which was: When I go to the Servlet Examples page (http://localhost:8080/examples/servlets/index.html), there is a link that executes the Hello World servlet. This link is http://localhost:8080/examples/servlet/HelloWorldExample. How does Tomcat know that when it sees "/examples/servlet/" in the URL, it is supposed to look in the examples/WEB-INF/classes directory for the HelloWorldExample.class file? I haven't been able to find anything in the server.xml or web.xml files that shows how this is configured. I see no servlet mappings in any of the configuration files that maps a servlet to "/examples/servlet/HelloWorldExample". Please tell me how this is set up. Thanks, Spencer -Original Message- From: Filip Hanik [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 11, 2001 7:37 PM To: [EMAIL PROTECTED] Subject: RE: A couple of questions first things first, you will have 90% of your questions answered by reading the servlet specification from Sun. this answers question 1 for you > 2) Would it be possible for me to place my application in a completely > separate directory tree and not in a war file? Or does it have to be in a > war file in the webapps directory? yes, you will just have to setup classpaths etc properly for servlets and other classes. The server.xml file allows you to configure other contexts outside of the webapps directory. Filip ~ Namaste - I bow to the divine in you ~ Filip Hanik Software Architect [EMAIL PROTECTED] www.filip.net > -Original Message- > From: Lu, Spencer [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 4:29 PM > To: '[EMAIL PROTECTED]' > Subject: A couple of questions > > > Hi, > > I've recently installed Tomcat 3.2.1 (win32) on my computer. I'm > trying to > understand how certain things are configured, and I have a couple of > questions: > > 1) When I go to the Servlet Examples page > (http://localhost:8080/examples/servlets/index.html), there is a link that > executes the Hello World servlet. This link is > http://localhost:8080/examples/servlet/HelloWorldExample. How does Tomcat > know that when it sees "/examples/servlet/" in the URL, it is supposed to > look in the examples/WEB-INF/classes directory for the > HelloWorldExample.class file? I haven't been able to find anything in the > server.xml or web.xml files that shows how this is configured. > > 2) Would it be possible for me to place my application in a completely > separate directory tree and not in a war file? Or does it have to be in a > war file in the webapps directory? > > Thanks for your help, > Spencer > >
RE: A couple of questions
first things first, you will have 90% of your questions answered by reading the servlet specification from Sun. this answers question 1 for you > 2) Would it be possible for me to place my application in a completely > separate directory tree and not in a war file? Or does it have to be in a > war file in the webapps directory? yes, you will just have to setup classpaths etc properly for servlets and other classes. The server.xml file allows you to configure other contexts outside of the webapps directory. Filip ~ Namaste - I bow to the divine in you ~ Filip Hanik Software Architect [EMAIL PROTECTED] www.filip.net > -Original Message- > From: Lu, Spencer [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 4:29 PM > To: '[EMAIL PROTECTED]' > Subject: A couple of questions > > > Hi, > > I've recently installed Tomcat 3.2.1 (win32) on my computer. I'm > trying to > understand how certain things are configured, and I have a couple of > questions: > > 1) When I go to the Servlet Examples page > (http://localhost:8080/examples/servlets/index.html), there is a link that > executes the Hello World servlet. This link is > http://localhost:8080/examples/servlet/HelloWorldExample. How does Tomcat > know that when it sees "/examples/servlet/" in the URL, it is supposed to > look in the examples/WEB-INF/classes directory for the > HelloWorldExample.class file? I haven't been able to find anything in the > server.xml or web.xml files that shows how this is configured. > > 2) Would it be possible for me to place my application in a completely > separate directory tree and not in a war file? Or does it have to be in a > war file in the webapps directory? > > Thanks for your help, > Spencer > >