org.apache.sling.scripting.jsp.jasper.servlet
Class JspServletWrapper

java.lang.Object
  extended by org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

public class JspServletWrapper
extends java.lang.Object

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
JspServletWrapper(javax.servlet.ServletConfig config, Options options, java.lang.String jspUri, boolean isErrorPage, JspRuntimeContext rctxt)
          JspServletWrapper for JSP pages.
JspServletWrapper(javax.servlet.ServletContext servletContext, Options options, java.lang.String tagFilePath, javax.servlet.jsp.tagext.TagInfo tagInfo, JspRuntimeContext rctxt, java.net.URL tagFileJarUrl)
          JspServletWrapper for tag files.
 
Method Summary
 int decTripCount()
           
 void destroy(boolean deleteGeneratedFiles)
           
 java.util.List<java.lang.String> getDependants()
          Get a list of files that the current page has source dependency on.
 JspCompilationContext getJspEngineContext()
           
 java.lang.String getJspUri()
           
protected  void handleJspException(java.lang.Exception ex)
          Attempts to construct a JasperException that contains helpful information about what went wrong.
 int incTripCount()
           
 boolean isTagFile()
           
 boolean isValid()
           
 java.lang.Class<?> loadTagFile()
          Compile (if needed) and load a tag file
 java.lang.Class<?> loadTagFilePrototype()
          Compile and load a prototype for the Tag file.
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process the request.
 void service(org.apache.sling.api.scripting.SlingBindings bindings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspServletWrapper

public JspServletWrapper(javax.servlet.ServletConfig config,
                         Options options,
                         java.lang.String jspUri,
                         boolean isErrorPage,
                         JspRuntimeContext rctxt)
JspServletWrapper for JSP pages.


JspServletWrapper

public JspServletWrapper(javax.servlet.ServletContext servletContext,
                         Options options,
                         java.lang.String tagFilePath,
                         javax.servlet.jsp.tagext.TagInfo tagInfo,
                         JspRuntimeContext rctxt,
                         java.net.URL tagFileJarUrl)
                  throws JasperException
JspServletWrapper for tag files.

Throws:
JasperException
Method Detail

getJspEngineContext

public JspCompilationContext getJspEngineContext()

isValid

public boolean isValid()

loadTagFile

public java.lang.Class<?> loadTagFile()
                               throws JasperException
Compile (if needed) and load a tag file

Throws:
JasperException

loadTagFilePrototype

public java.lang.Class<?> loadTagFilePrototype()
                                        throws JasperException
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

public java.util.List<java.lang.String> 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

public java.lang.String getJspUri()

service

public void service(org.apache.sling.api.scripting.SlingBindings bindings)
Parameters:
bindings -
Throws:
org.apache.sling.api.SlingIOException
org.apache.sling.api.SlingServletException
java.lang.IllegalArgumentException - if the Jasper Precompile controller request parameter has an illegal value.

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Process the request.

Throws:
javax.servlet.ServletException
java.io.IOException

destroy

public void destroy(boolean deleteGeneratedFiles)

handleJspException

protected void handleJspException(java.lang.Exception ex)
                           throws javax.servlet.ServletException

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 - ServletException with more detailed information
javax.servlet.ServletException


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.