https://issues.apache.org/bugzilla/show_bug.cgi?id=57142

--- Comment #9 from Konstantin Kolinko <knst.koli...@gmail.com> ---
Reviewing r1642233 and r1642280.

In general:
a) I wonder whether we can do some work once when JSP page servlet class
initializes, instead of doing everything a-new on each request.

b) I wonder whether all ImportHandler.importFoo() methods can be made faster. 

c) I think that pageContext.getELContext() is not fast, as it has to initialize
the ELContext, and ELContext is not reused between requests.


For b):
======
1. E.g. is Class.forName(), Package.getPackage() validation needed at import
time? Can it store imports as Map<String shortName,String fullName> and defer
Class.forName() calls?

>From Javadoc, I do not see a need for validation at import time.

http://docs.oracle.com/javaee/7/api/javax/el/ImportHandler.html

The javadoc mentions trivial "class name contains '.'" check. We need to do
lastIndexOf('.') to split class name from package name and "no '.'" found is a
clear error condition.


2. I think there is a bug in ImportHandler.findClass().

It shall not use Class.forName(), but use TCCL. I expect that Class.forName()
does not use WebappClassLoader and that it cannot load webapp classes.

(Not tested)

As a contrast, ImportHandler.importPackage() already uses TCCL when validating
a Package.


For c):
=====
3. Move the code that initializes imports from JSP class (the code that
Generator adds in r1642233) and move it into PageContextImpl.getELContext()
where ELContext is created.

This removes the need for PageInfo.isELUsed() flag added in r1642233 and
premature initialization of ELContext that Generator adds to JSP pages.  The
PageContextImpl.getELContext() method may initialize it when it is needed for
the first time.

Trivial
======
4. in ImportHandler.findClass() r1642280:
The "int modifiers = clazz.getModifiers();" call can be skipped when
validate==false.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to