Class JspServletWrapper
java.lang.Object
org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper
The JSP engine (a.k.a Jasper).
The servlet container is responsible for providing a
URLClassLoader for the web application context Jasper
is being used in. Jasper will try get the Tomcat
ServletContext attribute for its ServletContext class
loader, if that fails, it uses the parent class loader.
In either case, it must be a URLClassLoader.
- Author:
- Anil K. Vijendran, Harish Prabandham, Remy Maucherat, Kin-man Chung, Glenn Nielsen, Tim Fennell
-
Constructor Summary
ConstructorsConstructorDescriptionJspServletWrapper
(javax.servlet.ServletConfig config, Options options, String jspUri, boolean isErrorPage, JspRuntimeContext rctxt) JspServletWrapper for JSP pages.JspServletWrapper
(javax.servlet.ServletConfig config, Options options, String jspUri, boolean isErrorPage, JspRuntimeContext rctxt, javax.servlet.Servlet servlet) JspServletWrapper for precompiled JSPsJspServletWrapper
(javax.servlet.ServletContext servletContext, Options options, String tagFilePath, javax.servlet.jsp.tagext.TagInfo tagInfo, JspRuntimeContext rctxt, URL tagFileJarUrl) JspServletWrapper for tag files. -
Method Summary
Modifier and TypeMethodDescriptionint
void
destroy
(boolean deleteGeneratedFiles) Destroy this wrapperGet a list of files that the current page has source dependency on.Get the name of the dependencies file.protected void
Attempts to construct a JasperException that contains helpful information about what went wrong.int
boolean
boolean
isValid()
Class<?>
Compile (if needed) and load a tag fileClass<?>
Compile and load a prototype for the Tag file.void
service
(SlingBindings bindings) Call the jsp
-
Constructor Details
-
JspServletWrapper
public JspServletWrapper(javax.servlet.ServletConfig config, Options options, String jspUri, boolean isErrorPage, JspRuntimeContext rctxt) JspServletWrapper for JSP pages. -
JspServletWrapper
public JspServletWrapper(javax.servlet.ServletConfig config, Options options, String jspUri, boolean isErrorPage, JspRuntimeContext rctxt, javax.servlet.Servlet servlet) JspServletWrapper for precompiled JSPs -
JspServletWrapper
public JspServletWrapper(javax.servlet.ServletContext servletContext, Options options, String tagFilePath, javax.servlet.jsp.tagext.TagInfo tagInfo, JspRuntimeContext rctxt, URL tagFileJarUrl) throws JasperException JspServletWrapper for tag files.- Throws:
JasperException
-
-
Method Details
-
getJspEngineContext
-
isValid
public boolean isValid() -
getDependencyFilePath
Get the name of the dependencies file. -
loadTagFile
Compile (if needed) and load a tag file- Throws:
JasperException
-
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.- Throws:
JasperException
-
getDependants
Get a list of files that the current page has source dependency on. -
isTagFile
public boolean isTagFile() -
incTripCount
public int incTripCount() -
decTripCount
public int decTripCount() -
getJspUri
-
service
Call the jsp- Parameters:
bindings
- The bindings for the jsp- Throws:
org.apache.sling.scripting.jsp.SlingPageException
- JSP page exception handler exceptionsSlingException
- for any non runtime exceptionRuntimeException
- for runtime exceptions
-
destroy
public void destroy(boolean deleteGeneratedFiles) Destroy this wrapper- Parameters:
deleteGeneratedFiles
- Should generated files be deleted as well?
-
handleJspException
Attempts to construct a JasperException that contains helpful information about what went wrong. Uses the JSP compiler system to translate the line number in the generated servlet that originated the exception to a line number in the JSP. Then constructs an exception containing that information, and a snippet of the JSP to help debugging. Please see http://issues.apache.org/bugzilla/show_bug.cgi?id=37062 and http://www.tfenne.com/jasper/ for more details.
- Parameters:
ex
- the exception that was the cause of the problem.- Throws:
a
- SlingException Wrapping the original exception
-