FileDocCategorySizeDatePackage
JspFactoryImpl.javaAPI DocApache Tomcat 6.0.147191Fri Jul 20 04:20:34 BST 2007org.apache.jasper.runtime

JspFactoryImpl

public class JspFactoryImpl extends javax.servlet.jsp.JspFactory
Implementation of JspFactory.
author
Anil K. Vijendran

Fields Summary
private org.apache.juli.logging.Log
log
private static final String
SPEC_VERSION
private static final boolean
USE_POOL
private static final int
POOL_SIZE
private ThreadLocal
localPool
Constructors Summary
Methods Summary
public javax.servlet.jsp.JspEngineInfogetEngineInfo()

        return new JspEngineInfo() {
            public String getSpecificationVersion() {
                return SPEC_VERSION;
            }
        };
    
public javax.servlet.jsp.JspApplicationContextgetJspApplicationContext(javax.servlet.ServletContext context)

        return JspApplicationContextImpl.getInstance(context);
    
public javax.servlet.jsp.PageContextgetPageContext(javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String errorPageURL, boolean needsSession, int bufferSize, boolean autoflush)


         
                 
                

        if( Constants.IS_SECURITY_ENABLED ) {
            PrivilegedGetPageContext dp = new PrivilegedGetPageContext(
                    (JspFactoryImpl)this, servlet, request, response, errorPageURL,
                    needsSession, bufferSize, autoflush);
            return (PageContext)AccessController.doPrivileged(dp);
        } else {
            return internalGetPageContext(servlet, request, response,
                    errorPageURL, needsSession,
                    bufferSize, autoflush);
        }
    
private javax.servlet.jsp.PageContextinternalGetPageContext(javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String errorPageURL, boolean needsSession, int bufferSize, boolean autoflush)

        try {
            PageContext pc;
            if (USE_POOL) {
                PageContextPool pool = localPool.get();
                if (pool == null) {
                    pool = new PageContextPool();
                    localPool.set(pool);
                }
                pc = pool.get();
                if (pc == null) {
                    pc = new PageContextImpl();
                }
            } else {
                pc = new PageContextImpl();
            }
            pc.initialize(servlet, request, response, errorPageURL, 
                    needsSession, bufferSize, autoflush);
            return pc;
        } catch (Throwable ex) {
            /* FIXME: need to do something reasonable here!! */
            log.fatal("Exception initializing page context", ex);
            return null;
        }
    
private voidinternalReleasePageContext(javax.servlet.jsp.PageContext pc)

        pc.release();
        if (USE_POOL && (pc instanceof PageContextImpl)) {
            localPool.get().put(pc);
        }
    
public voidreleasePageContext(javax.servlet.jsp.PageContext pc)

        if( pc == null )
            return;
        if( Constants.IS_SECURITY_ENABLED ) {
            PrivilegedReleasePageContext dp = new PrivilegedReleasePageContext(
                    (JspFactoryImpl)this,pc);
            AccessController.doPrivileged(dp);
        } else {
            internalReleasePageContext(pc);
        }