Hi there,

I did write some code to create dynamic compiler for JSP pages, because our
application sets development options parameter to be false for JspServlet.
In order to fulfill the requirement, I viewed the correlative code of Japser
engine.

At first, I implemented the Options , JspRuntimeContext , and created a new
Servlet to interpret and compile the JSP page,it works fine, and the class
file was created in work directory, but JspServletWrapper does not reload
it,I checked the source of JspServletWrapper, and found the field reload is
false ,thus , did not reload it. It's correct.

However, I tried one way to find the JspServlet instance in tomcat, and
register a Servlet Filter to map all *.jsp and *.jspx. I know the singleton
instance of JspServlet (it works) services for all *.jsp and *.jspx in one
container, the FilterChain implemention
class(org.apache.catalina.core.ApplicationFilterChain) can be taken
advantage of retrieving this JspServlet instance, Luckly, I successfully
retrieved that one, and than I'd like to set the reload is true by
invocation JspServletWrapper#setReload(true) method.

Although the reload is true,unfortunately , The JasperLoader can't find the
class file,for instance, the class file that is placed in
${CATALINA_HOME}/work/localhost/catalina/_/org/apache/jsp/test/_2_jsp.class
is a new created class by my code sucessfully,the
JasperLoader#loadClass(String name) can't load it, another JSP pages that
are created by application work fine in the same directory, is it caused by
ClassLoader? In fact , my compiler invokes the
JspServletWrapper#service(request,response,true), it was loaded once,so I'm
confused. :-(

The version of My tomcat is Apache Tomcat/6.0.18 under jdk1.6.0_16, IDE is
Eclipse 3.4 JEE

Thank you in advanced. :-)

Kind regards,
Mercy

Reply via email to