Constructors Summary |
---|
JspServletWrapper(ServletConfig config, org.apache.jasper.Options options, String jspUri, boolean isErrorPage, org.apache.jasper.compiler.JspRuntimeContext rctxt)
/*
* JspServletWrapper for JSP pages.
*/
this.isTagFile = false;
this.config = config;
this.options = options;
this.jspUri = jspUri;
ctxt = new JspCompilationContext(jspUri, isErrorPage, options,
config.getServletContext(),
this, rctxt);
// START PWC 6468930
String jspFilePath = ctxt.getRealPath(jspUri);
if (jspFilePath != null) {
jspFile = new File(jspFilePath);
}
// END PWC 6468930
|
public JspServletWrapper(ServletContext servletContext, org.apache.jasper.Options options, String tagFilePath, javax.servlet.jsp.tagext.TagInfo tagInfo, org.apache.jasper.compiler.JspRuntimeContext rctxt, URL tagFileJarUrl)
this.isTagFile = true;
this.config = null; // not used
this.options = options;
this.jspUri = tagFilePath;
this.tripCount = 0;
ctxt = new JspCompilationContext(jspUri, tagInfo, options,
servletContext, this, rctxt,
tagFileJarUrl);
|
Methods Summary |
---|
public int | decTripCount()
return tripCount--;
|
public void | destroy()
if (theServlet != null) {
theServlet.destroy();
}
|
public java.util.List | getDependants()Get a list of files that the current page has source dependency on.
try {
Object target;
if (isTagFile) {
if (reload) {
tagHandlerClass = ctxt.load();
}
target = tagHandlerClass.newInstance();
} else {
target = getServlet();
}
if (target != null && target instanceof JspSourceDependent) {
/* GlassFish Issue 812
return ((JspSourceDependent) target).getDependants();
*/
// START GlassFish Issue 812
return (java.util.List) ((JspSourceDependent) target).getDependants();
// END GlassFish Issue 812
}
} catch (Throwable ex) {
}
return null;
|
public org.apache.jasper.JspCompilationContext | getJspEngineContext()
return ctxt;
|
public java.io.File | getJspFile()
return jspFile;
|
public long | getLastModificationTest()
return lastModificationTest;
|
public javax.servlet.Servlet | getServlet()
if (reload) {
synchronized (this) {
// Synchronizing on jsw enables simultaneous loading
// of different pages, but not the same page.
if (reload) {
// 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);
if (!firstTime) {
ctxt.getRuntimeContext().incrementJspReloadCount();
}
reload = false;
}
}
}
return theServlet;
|
public long | getServletClassLastModifiedTime()Gets the last-modified time of the servlet class file associated with
this JspServletWrapper.
return servletClassLastModifiedTime;
|
public javax.servlet.ServletContext | getServletContext()
return config.getServletContext();
|
public int | incTripCount()
return tripCount++;
|
public boolean | isTagFile()
return this.isTagFile;
|
private void | jspFileNotFound(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
FileNotFoundException fnfe = new FileNotFoundException(jspUri);
ctxt.incrementRemoved();
String includeRequestUri = (String)
request.getAttribute("javax.servlet.include.request_uri");
if (includeRequestUri != null) {
// This file was included. Throw an exception as
// a response.sendError() will be ignored by the
// servlet engine.
throw new ServletException(fnfe);
} else {
try {
response.sendError(HttpServletResponse.SC_NOT_FOUND,
fnfe.getMessage());
} catch (IllegalStateException ise) {
log.error(Localizer.getMessage("jsp.error.file.not.found",
fnfe.getMessage()),
fnfe);
}
}
|
public java.lang.Class | loadTagFile()Compile (if needed) and load a tag file
try {
ctxt.compile();
if (reload) {
tagHandlerClass = ctxt.load();
}
} catch (FileNotFoundException ex) {
throw new JasperException(ex);
}
return tagHandlerClass;
|
public java.lang.Class | loadTagFilePrototype()Compile and load a prototype for the Tag file. This is needed
when compiling tag files with circular dependencies. A prototpe
(skeleton) with no dependencies on other other tag files is
generated and compiled.
ctxt.setPrototypeMode(true);
try {
return loadTagFile();
} finally {
ctxt.setPrototypeMode(false);
}
|
public void | service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean precompile)
try {
if (ctxt.isRemoved()) {
jspFileNotFound(request, response);
return;
}
if ((available > 0L) && (available < Long.MAX_VALUE)) {
response.setDateHeader("Retry-After", available);
response.sendError
(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
Localizer.getMessage("jsp.error.unavailable"));
}
/*
* (1) Compile
*/
// BEGIN S1AS 6181923
// if (options.getDevelopment() || firstTime) {
// END S1AS 6181923
// BEGIN S1AS 6181923
if (!options.getUsePrecompiled()
&& (options.getDevelopment() || firstTime)) {
// END S1AS 6181923
synchronized (this) {
firstTime = false;
// The following sets reload to true, if necessary
ctxt.compile();
}
} else {
if (compileException != null) {
// Throw cached compilation exception
throw compileException;
}
}
/*
* (2) (Re)load servlet class file
*/
getServlet();
// If a page is to be precompiled only, return.
if (precompile) {
return;
}
/*
* (3) Service request
*/
if (theServlet instanceof SingleThreadModel) {
// sync on the wrapper so that the freshness
// of the page is determined right before servicing
synchronized (this) {
theServlet.service(request, response);
}
} else {
theServlet.service(request, response);
}
} catch (UnavailableException ex) {
String includeRequestUri = (String)
request.getAttribute("javax.servlet.include.request_uri");
if (includeRequestUri != null) {
// This file was included. Throw an exception as
// a response.sendError() will be ignored by the
// servlet engine.
throw ex;
} else {
int unavailableSeconds = ex.getUnavailableSeconds();
if (unavailableSeconds <= 0) {
unavailableSeconds = 60; // Arbitrary default
}
available = System.currentTimeMillis() +
(unavailableSeconds * 1000L);
response.sendError
(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
ex.getMessage());
}
} catch (ServletException ex) {
throw ex;
} catch (IOException ex) {
throw ex;
} catch (IllegalStateException ex) {
throw ex;
} catch (Exception ex) {
throw new JasperException(ex);
}
|
public void | setCompilationException(org.apache.jasper.JasperException je)Sets the compilation exception for this JspServletWrapper.
this.compileException = je;
|
public void | setLastModificationTest(long lastModificationTest)
this.lastModificationTest = lastModificationTest;
|
public void | setReload(boolean reload)
this.reload = reload;
|
public void | setServletClassLastModifiedTime(long lastModified)Sets the last-modified time of the servlet class file associated with
this JspServletWrapper.
if (this.servletClassLastModifiedTime < lastModified) {
synchronized (this) {
if (this.servletClassLastModifiedTime < lastModified) {
this.servletClassLastModifiedTime = lastModified;
reload = true;
}
}
}
|