Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tomcat.facade
Class JspInterceptor

    java.lang.Object
      org.apache.tomcat.core.BaseInterceptor
          org.apache.tomcat.facade.JspInterceptor

public class JspInterceptor
extends BaseInterceptor

Plug in the JSP engine (a.k.a Jasper)! Tomcat uses a "built-in" mapping for jsps ( *.jsp -> jsp ). "jsp" can be either a real servlet (JspServlet) that compiles the jsp and include the resource, or we can "intercept" and do the compilation and mapping in requestMap stage. JspInterceptor will be invoked once per jsp, and will add an exact mapping - all further invocation are identical with servlet invocations with direct maps, with no extra overhead. Future - better abstraction for jsp->java converter ( jasper ), better abstraction for java->class, plugin other jsp implementations, better scalability.

Author:
  Anil K. Vijendran, Harish Prabandham, Costin Manolache

Field Summary

Fields inherited from class org.apache.tomcat.core.BaseInterceptor
`cm, ct, ctx, debug, DECLINED, loghelper, OK`

Constructor Summary
`JspInterceptor()`

Method Summary
`void` | `addContext(ContextManager cm, Context ctx)` Jasper-specific initializations, add work dir to classpath,
`void` | `contextInit(Context ctx)` Do the needed initialization if jspServlet is used.
`int` | `preInitCheck(Request req, Handler sw)` Check if the JSP page needs to be re-compiled.
`void` | `preServletInit(Context ctx, Handler sw)` Set the HttpJspBase classloader before init, as required by Jasper
`int` | `requestMap(Request req)` Detect if the request is for a JSP page and if it is find the associated servlet name and compile if needed.
`void` | `setClassDebugInfo(java.lang.String s)` Include debug information in generated classes
`void` | `setClassPath(java.lang.String s)` What classpath should I use while compiling the servlets generated from JSP files?
`void` | `setIEClassId(java.lang.String s)` Class ID for use in the plugin tag when the browser is IE.
`void` | `setJavaCompiler(java.lang.String type)` What compiler should I use to compile the servlets generated from JSP files? Default is "javac" ( you can use "jikes" as a shortcut ).
`void` | `setJikesClasspath(java.lang.String cp)`
`void` | `setJspCompilerPath(java.lang.String s)` Path of the compiler to use for compiling JSP pages.
`void` | `setJspCompilerPlugin(java.lang.String s)` Deprecated. Use setJavaCompiler instead
`void` | `setJspServlet(java.lang.String s)` Specify the implementation class of the jsp servlet.
`void` | `setKeepGenerated(java.lang.String s)` Are we keeping generated code around?
`void` | `setLargeFile(java.lang.String s)` Are we supporting large files?
`void` | `setMappedFile(java.lang.String s)` Are we supporting HTML mapped servlets?
`void` | `setPageContextPoolSize(int i)` Set the PageContext pool size for jasper factory.
`void` | `setProperty(java.lang.String n, java.lang.String v)`
`void` | `setRuntimePackage(java.lang.String rp)` The generator will produce code using a different runtime ( default is org.apache.jasper.runtime ).
`void` | `setScratchdir(java.lang.String s)` What is my scratch dir?
`void` | `setSendErrToClient(java.lang.String s)` Should errors be sent to client or thrown into stderr?
`void` | `setUseJspServlet(boolean b)` Use the old JspServlet to execute Jsps, instead of the new code.
`void` | `setUseWebAppCL(boolean b)` Compile using the web application classloader.

Methods inherited from class org.apache.tomcat.core.BaseInterceptor
`addContainer, addHandler, addInterceptor, addSecurityConstraint, afterBody, authenticate, authorize, beforeBody, beforeCommit, contextMap, contextShutdown, contextState, copyContext, engineInit, engineShutdown, engineStart, engineState, engineStop, findSession, getContext, getContextManager, getDebug, getInfo, getLog, getNote, getNote, handleError, log, log, log, log, postInitCheck, postReadRequest, postRequest, postService, postServletDestroy, postServletInit, preService, preServletDestroy, registerHooks, reload, removeContainer, removeContext, removeHandler, removeInterceptor, sessionState, setContext, setContextManager, setDebug, setInfo, setNote, setNote`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JspInterceptor

    public JspInterceptor()

Method Detail

### setKeepGenerated

    public void setKeepGenerated(java.lang.String s)

  Are we keeping generated code around?

### setLargeFile

    public void setLargeFile(java.lang.String s)

  Are we supporting large files?

### setMappedFile

    public void setMappedFile(java.lang.String s)

  Are we supporting HTML mapped servlets?

### setSendErrToClient

    public void setSendErrToClient(java.lang.String s)

  Should errors be sent to client or thrown into stderr?

### setIEClassId

    public void setIEClassId(java.lang.String s)

  Class ID for use in the plugin tag when the browser is IE.

### setClassPath

    public void setClassPath(java.lang.String s)

  What classpath should I use while compiling the servlets generated from JSP files?

### setScratchdir

    public void setScratchdir(java.lang.String s)

  What is my scratch dir?

### setJspCompilerPath

    public void setJspCompilerPath(java.lang.String s)

  Path of the compiler to use for compiling JSP pages.

### setJspCompilerPlugin

    public void setJspCompilerPlugin(java.lang.String s)

  Deprecated. Use setJavaCompiler instead

  What compiler plugin should I use to compile the servlets generated from JSP files?

### setClassDebugInfo

    public void setClassDebugInfo(java.lang.String s)

  Include debug information in generated classes

### setProperty

    public void setProperty(java.lang.String n,
                            java.lang.String v)

### setJikesClasspath

    public void setJikesClasspath(java.lang.String cp)

### setUseJspServlet

    public void setUseJspServlet(boolean b)

  Use the old JspServlet to execute Jsps, instead of the new code. Note that init() never worked (AFAIK) and it'll be slower - but given the stability of JspServlet it may be a safe option. This will significantly slow down jsps. Default is false.

### setJspServlet

    public void setJspServlet(java.lang.String s)

  Specify the implementation class of the jsp servlet.

### setJavaCompiler

    public void setJavaCompiler(java.lang.String type)

  What compiler should I use to compile the servlets generated from JSP files? Default is "javac" ( you can use "jikes" as a shortcut ).

### setPageContextPoolSize

    public void setPageContextPoolSize(int i)

  Set the PageContext pool size for jasper factory. 0 will disable pooling of PageContexts.

### setRuntimePackage

    public void setRuntimePackage(java.lang.String rp)

  The generator will produce code using a different runtime ( default is org.apache.jasper.runtime ). The runtime must use the same names for classes as the default one, so the code will compile.

### setUseWebAppCL

    public void setUseWebAppCL(boolean b)

  Compile using the web application classloader. This was added as part of dealing a problem with tools.jar on some HP-UX systems.

### addContext

    public void addContext(ContextManager cm,
                           Context ctx)
                    throws TomcatException

  Jasper-specific initializations, add work dir to classpath,

  Overrides:
    `addContext` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### contextInit

    public void contextInit(Context ctx)
                     throws TomcatException

  Do the needed initialization if jspServlet is used. It must be called after Web.xml is read ( WebXmlReader ).

  Overrides:
    `contextInit` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### preServletInit

    public void preServletInit(Context ctx,
                               Handler sw)
                        throws TomcatException

  Set the HttpJspBase classloader before init, as required by Jasper

  Overrides:
    `preServletInit` in class `BaseInterceptor`
  Throws:
    `TomcatException`

### requestMap

    public int requestMap(Request req)

  Detect if the request is for a JSP page and if it is find the associated servlet name and compile if needed. That insures that init() will take place on the equivalent servlet - and behave exactly like a servlet. A request is for a JSP if: - the handler is a ServletHandler ( i.e. defined in web.xml or dynamically loaded servlet ) and it has a "path" instead of class name - the handler has a special name "jsp". That means a *.jsp -> jsp needs to be defined. This is a tomcat-specific mechanism ( not part of the standard ) and allow users to associate other extensions with JSP by using the "fictious" jsp handler. An (cleaner?) alternative for mapping other extensions would be to set them on JspInterceptor.

  Overrides:
    `requestMap` in class `BaseInterceptor`

### preInitCheck

    public int preInitCheck(Request req,
                            Handler sw)
                     throws TomcatException

  Check if the JSP page needs to be re-compiled.

  Overrides:
    `preInitCheck` in class `BaseInterceptor`
  Throws:
    `TomcatException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 Apache Software Foundation. All Rights Reserved.