You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/06/21 01:05:27 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java
costin 2002/06/20 16:05:27
Modified: jasper2/src/share/org/apache/jasper/servlet
JspServletWrapper.java
Log:
Update to JspCompilationContext.
Move the code to load the servlet in a method - that can also be called
before service(), allowing us to load the class which in turns allow
to detect the dependencies.
Revision Changes Path
1.5 +38 -22 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java
Index: JspServletWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JspServletWrapper.java 11 May 2002 05:00:22 -0000 1.4
+++ JspServletWrapper.java 20 Jun 2002 23:05:27 -0000 1.5
@@ -78,7 +78,7 @@
import org.apache.jasper.JasperException;
import org.apache.jasper.Constants;
import org.apache.jasper.Options;
-import org.apache.jasper.JspEngineContext;
+import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.compiler.JspRuntimeContext;
import org.apache.jasper.runtime.HttpJspBase;
@@ -106,7 +106,7 @@
private Servlet theServlet;
private String jspUri;
private Class servletClass;
- private JspEngineContext ctxt;
+ private JspCompilationContext ctxt;
private long available = 0L;
private ServletConfig config;
private Options options;
@@ -118,16 +118,42 @@
this.config = config;
this.options = options;
this.jspUri = jspUri;
- ctxt = new JspEngineContext
- (rctxt, config.getServletContext(), jspUri,
- this, isErrorPage, options);
+ ctxt = new JspCompilationContext( jspUri, isErrorPage,
+ options,
+ config.getServletContext(),
+ this, rctxt);
+ ctxt.createOutdir();
}
- public JspEngineContext getJspEngineContext() {
+ public JspCompilationContext getJspEngineContext() {
return ctxt;
}
- public HttpJspBase getServlet() {
+ public HttpJspBase getServlet()
+ throws ServletException, IOException, FileNotFoundException
+ {
+ if (ctxt.isReload()) {
+ synchronized (this) {
+ // Synchronizing on jsw enables simultaneous loading
+ // of different pages, but not the same page.
+ if (ctxt.isReload()) {
+ System.out.println("JspServletWrapper - isReload ");
+ // This is to maintain the original protocol.
+ destroy();
+
+ try {
+ servletClass = ctxt.load();
+ theServlet = (Servlet) servletClass.newInstance();
+ } catch( IllegalAccessException ex1 ) {
+ throw new JasperException( ex1 );
+ } catch( InstantiationException ex ) {
+ throw new JasperException( ex );
+ }
+
+ theServlet.init(config);
+ }
+ }
+ }
return (HttpJspBase)theServlet;
}
@@ -154,23 +180,13 @@
if (options.getDevelopment()) {
synchronized (this) {
+ System.out.println("JspServletWrapper - development compile ");
ctxt.compile();
}
}
if (ctxt.isReload()) {
- synchronized (this) {
-
- // Synchronizing on jsw enables simultaneous loading
- // of different pages, but not the same page.
- if (ctxt.isReload()) {
- servletClass = ctxt.load();
- // This is to maintain the original protocol.
- destroy();
- theServlet = (Servlet) servletClass.newInstance();
- theServlet.init(config);
- }
- }
+ getServlet();
}
// If a page is to only to be precompiled return.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>