JspServletWrapper (Apache Tomcat 9.0.118 API Documentation)
Description: declaration: package: org.apache.jasper.servlet, class: JspServletWrapper

# Class JspServletWrapper

java.lang.Object
org.apache.jasper.servlet.JspServletWrapper

public class JspServletWrapper extends Object
The Jasper JSP engine. The servlet container is responsible for providing a URLClassLoader for the web application context Jasper is being used in. Jasper will try to 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.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JspServletWrapper(ServletConfig config, Options options, String jspUri, JspRuntimeContext rctxt)`
  `JspServletWrapper(ServletContext servletContext, Options options, String tagFilePath, TagInfo tagInfo, JspRuntimeContext rctxt, Jar tagJar)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `decTripCount()`
  `void`
  `destroy()`
  `Map<String,Long>`
  `getDependants()`
  Get a list of files that the current page has source dependency on.
  `JspCompilationContext`
  `getJspEngineContext()`
  `String`
  `getJspUri()`
  `long`
  `getLastModificationTest()`
  `long`
  `getLastUsageTime()`
  `boolean`
  `getReload()`
  `Servlet`
  `getServlet()`
  `ServletContext`
  `getServletContext()`
  `FastRemovalDequeue<JspServletWrapper>.Entry`
  `getUnloadHandle()`
  `protected JasperException`
  `handleJspException(Exception ex)`
  Attempts to construct a JasperException that contains helpful information about what went wrong.
  `int`
  `incTripCount()`
  `boolean`
  `isTagFile()`
  `Class<?>`
  `loadTagFile()`
  Compile (if needed) and load a tag file.
  `Class<?>`
  `loadTagFilePrototype()`
  Compile and load a prototype for the Tag file.
  `void`
  `service(HttpServletRequest request, HttpServletResponse response, boolean precompile)`
  `void`
  `setCompilationException(JasperException je)`
  Sets the compilation exception for this JspServletWrapper.
  `void`
  `setLastModificationTest(long lastModificationTest)`
  `void`
  `setReload(boolean reload)`
  `void`
  `setServletClassLastModifiedTime(long lastModified)`
  Sets the last-modified time of the servlet class file associated with this JspServletWrapper.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### JspServletWrapper

    public JspServletWrapper(ServletConfig config, Options options, String jspUri, JspRuntimeContext rctxt)

  - ### JspServletWrapper

    public JspServletWrapper(ServletContext servletContext, Options options, String tagFilePath, TagInfo tagInfo, JspRuntimeContext rctxt, Jar tagJar)

- ## Method Details

  - ### getJspEngineContext

    public JspCompilationContext getJspEngineContext()

  - ### setReload

    public void setReload(boolean reload)

  - ### getReload

    public boolean getReload()

  - ### getServlet

    public Servlet getServlet() throws ServletException
    Throws:
      `ServletException`

  - ### getServletContext

    public ServletContext getServletContext()

  - ### setCompilationException

    public void setCompilationException(JasperException je)
    Sets the compilation exception for this JspServletWrapper.
    Parameters:
      `je` - The compilation exception

  - ### setServletClassLastModifiedTime

    public void setServletClassLastModifiedTime(long lastModified)
    Sets the last-modified time of the servlet class file associated with this JspServletWrapper.
    Parameters:
      `lastModified` - Last-modified time of servlet class

  - ### loadTagFile

    public Class<?> loadTagFile() throws JasperException
    Compile (if needed) and load a tag file.
    Returns:
      the loaded class
    Throws:
      `JasperException` - Error compiling or loading tag file

  - ### loadTagFilePrototype

    public Class<?> loadTagFilePrototype() throws JasperException
    Compile and load a prototype for the Tag file. This is needed when compiling tag files with circular dependencies. A prototype (skeleton) with no dependencies on other tag files is generated and compiled.
    Returns:
      the loaded class
    Throws:
      `JasperException` - Error compiling or loading tag file

  - ### getDependants

    public Map<String,Long> getDependants()
    Get a list of files that the current page has source dependency on.
    Returns:
      the map of dependent resources

  - ### isTagFile

    public boolean isTagFile()

  - ### incTripCount

    public int incTripCount()

  - ### decTripCount

    public int decTripCount()

  - ### getJspUri

    public String getJspUri()

  - ### getUnloadHandle

    public FastRemovalDequeue<JspServletWrapper>.Entry getUnloadHandle()

  - ### service

    public void service(HttpServletRequest request, HttpServletResponse response, boolean precompile) throws ServletException, IOException, FileNotFoundException
    Throws:
      `ServletException`
      `IOException`
      `FileNotFoundException`

  - ### destroy

    public void destroy()

  - ### getLastModificationTest

    public long getLastModificationTest()
    Returns:
      Returns the lastModificationTest.

  - ### setLastModificationTest

    public void setLastModificationTest(long lastModificationTest)
    Parameters:
      `lastModificationTest` - The lastModificationTest to set.

  - ### getLastUsageTime

    public long getLastUsageTime()
    Returns:
      the lastUsageTime.

  - ### handleJspException

    protected JasperException handleJspException(Exception ex)

    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 BZ 37062 for more details.

    Parameters:
      `ex` - the exception that was the cause of the problem.
    Returns:
      a JasperException with more detailed information