On Tue, 22 Oct 2002, Jacob Kjome wrote:

> Date: Tue, 22 Oct 2002 08:32:18 -0500
> From: Jacob Kjome <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: multiple servlet instances?
>
>
> Well, there still can be multiple instances.  For instance, if you access
> the servlet in different ways.  Every mapping of the servlet will beget a
> new instance.  If you have a servlet class "com.mycompany.MyServlet" that
> you've given the name "myservlet", then the following will beget two
> instances of that servetl:
>
> http://localhost:8080/myapp/servlet/com.mycompany.MyServlet
> http://localhost:8080/myapp/servlet/myservlet
>
> Then in you map "myservlet" to "/theservlet", now you have another instance
> with:
>
> http://localhost:8080/myapp/theservlet
>
> So, that is is 3 instances in all.  However, it is still technically
> correct that given any one instance, the container will not create multiple
> instances of that instance, as Craig says.
>

The precise rule is that there is a single instance per servlet
*definition*, not per servlet *mapping*.  A servlet definition is:

* A single <servlet> element (no matter how many mappings point at it)
  from your web.xml file

* A dynamically created definition when you use the invoker servlet
  (i.e. the /servlet/* mapping), which is a Tomcat feature and nothing
  to do with the servlet specification.

> Jake
>

Craig


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to