You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Arieh Markel <Ar...@Central.Sun.COM> on 2000/03/02 20:54:02 UTC

Backwards compatibility issue

With M2 there are severl Context methods that were eliminated:

	containsMapping ()
	containsServlet (String)
	containsServletByName (String)
	
M2 provides for similar functionality for most of those with:

	getServletByName (String)
	
However, it does not provide for querying by class, unless I do the
query myself, in the following manner:

	Enumeration e = ctx.getServletNames ();
	for (; e.hasMoreElements();)
	{
	    // compare appropriate elements
	}
	
--
Incidentally, I also ran into the following problem.

The getServletByName method actually returns a ServletWrapper.

That ServletWrapper has not verified the validity of the servlet
class that has been associated with it.

In short, it is not enough to query for gte getServletByName(), but it
is also necessary to invoke a ServletWrapper.getServlet() to ascertain
that the servlet indeed exists.

Arieh
--
 Arieh Markel		                Sun Microsystems Inc.
 Network Storage                        500 Eldorado Blvd. MS UBRM11-194
 e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
 Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
 (e-mail me with subject SEND PUBLIC KEY to get public key)


Re: Backwards compatibility issue

Posted by Adam Rossi <ad...@platinumsolutions.com>.
----- Original Message -----
From: "Chee Foong" <cf...@seasllc.com>
To: <ge...@jakarta.apache.org>
Sent: Thursday, March 02, 2000 3:46 PM
Subject: Re: Backwards compatibility issue


> hi, I am new to tom cat. I have downloaded the rpm file to for red hat 6.X
> but when I install it on the machine, it gives me error that group and
user
> constin does not exist. Is there anything that I should have done before
> installing the rpm?
>
> Arieh Markel wrote:

I had the same problem with the 3.0 RPM and posted a message about it around
3 months ago. If you want to install the rpm, go ahead and make a user named
costin, then install the RPM. Or compile the source. The RPM needs to be
fixed.

-------------------
Adam Rossi
President, PlatinumSolutions, Inc.
adam.rossi@platinumsolutions.com
http://www.platinumsolutions.com
P.O. Box 31   Oakton, VA 22124
PH: 703.352.8576  FAX: 703.352.8577

>
> > With M2 there are severl Context methods that were eliminated:
> >
> >         containsMapping ()
> >         containsServlet (String)
> >         containsServletByName (String)
> >
> > M2 provides for similar functionality for most of those with:
> >
> >         getServletByName (String)
> >
> > However, it does not provide for querying by class, unless I do the
> > query myself, in the following manner:
> >
> >         Enumeration e = ctx.getServletNames ();
> >         for (; e.hasMoreElements();)
> >         {
> >             // compare appropriate elements
> >         }
> >
> > --
> > Incidentally, I also ran into the following problem.
> >
> > The getServletByName method actually returns a ServletWrapper.
> >
> > That ServletWrapper has not verified the validity of the servlet
> > class that has been associated with it.
> >
> > In short, it is not enough to query for gte getServletByName(), but it
> > is also necessary to invoke a ServletWrapper.getServlet() to ascertain
> > that the servlet indeed exists.
> >
> > Arieh
> > --
> >  Arieh Markel                           Sun Microsystems Inc.
> >  Network Storage                        500 Eldorado Blvd. MS UBRM11-194
> >  e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
> >  Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
> >  (e-mail me with subject SEND PUBLIC KEY to get public key)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: general-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
>
>


Re: Backwards compatibility issue

Posted by Chee Foong <cf...@seasllc.com>.
hi, I am new to tom cat. I have downloaded the rpm file to for red hat 6.X
but when I install it on the machine, it gives me error that group and user
constin does not exist. Is there anything that I should have done before
installing the rpm?

Arieh Markel wrote:

> With M2 there are severl Context methods that were eliminated:
>
>         containsMapping ()
>         containsServlet (String)
>         containsServletByName (String)
>
> M2 provides for similar functionality for most of those with:
>
>         getServletByName (String)
>
> However, it does not provide for querying by class, unless I do the
> query myself, in the following manner:
>
>         Enumeration e = ctx.getServletNames ();
>         for (; e.hasMoreElements();)
>         {
>             // compare appropriate elements
>         }
>
> --
> Incidentally, I also ran into the following problem.
>
> The getServletByName method actually returns a ServletWrapper.
>
> That ServletWrapper has not verified the validity of the servlet
> class that has been associated with it.
>
> In short, it is not enough to query for gte getServletByName(), but it
> is also necessary to invoke a ServletWrapper.getServlet() to ascertain
> that the servlet indeed exists.
>
> Arieh
> --
>  Arieh Markel                           Sun Microsystems Inc.
>  Network Storage                        500 Eldorado Blvd. MS UBRM11-194
>  e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
>  Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
>  (e-mail me with subject SEND PUBLIC KEY to get public key)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org


Re: Backwards compatibility issue

Posted by co...@eng.sun.com.
> With M2 there are severl Context methods that were eliminated:
> 
> 	containsMapping ()
> 	containsServlet (String)
> 	containsServletByName (String)
> 	
> M2 provides for similar functionality for most of those with:
> 
> 	getServletByName (String)
> 	
> However, it does not provide for querying by class, unless I do the
> query myself, in the following manner:
> 
> 	Enumeration e = ctx.getServletNames ();
> 	for (; e.hasMoreElements();)
> 	{
> 	    // compare appropriate elements
> 	}

That was part of the cleanup. 

Regarding containsXXX, it is equivalent with getXXX()!=null
( and that was the implementation ). 

We have far too many methods - we need to remove, not to add. 
( the problem with too many methods is that we need to support them)

Also, note that the whole model is _bad_ for performance - the
"recomended" method is to implement ContextInterceptor and use
addContainer() notifications to maintain your own mapping table. This way
you can use an optimized data structure instead of the "default"
Hashtable. 
( Container = path + associated properties, it is used to represent
mappings and security constraints, or any other location properties. )

> --
> Incidentally, I also ran into the following problem.
> 
> The getServletByName method actually returns a ServletWrapper.
> 
> That ServletWrapper has not verified the validity of the servlet
> class that has been associated with it.
> 
> In short, it is not enough to query for gte getServletByName(), but it
> is also necessary to invoke a ServletWrapper.getServlet() to ascertain
> that the servlet indeed exists.

You can call getServletClass() if you need the class name.
The servlet is loaded before execution, we are not required to load all
servlets at start-up. Don't call getServlet() unless you want the servlet
to be loaded _and_ initialized. You can do:

context.getServletLoader().loadClass( servletClassName) !=null  to test 
if the class exists.
( and maybe ServletWrapper.setServletClass( ) to save the result and
avoid another call when the servlet is loaded )

In short - you have full control, it's better than tomcat guessing what to
do. 

BTW, please send all the feedback about APIs - and if you think it's a
important design bug that has to be included in 3.1 or it can wait till
3.2.  

In this particular case I think it's better to not add back those methods.

Costin