FileDocCategorySizeDatePackage
JspFactoryImpl.javaAPI DocGlassfish v2 API7519Fri May 04 22:32:54 BST 2007org.apache.jasper.runtime

JspFactoryImpl

public class JspFactoryImpl extends javax.servlet.jsp.JspFactory
Implementation of JspFactory.
author
Anil K. Vijendran
author
Kin-man Chung

Fields Summary
private static com.sun.org.apache.commons.logging.Log
log
private static final String
SPEC_VERSION
private static final boolean
USE_POOL
private ThreadLocal
pool
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.findJspApplicationContext(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 = null;
	    if( USE_POOL ) {
                LinkedList<PageContext> pcPool = (LinkedList<PageContext>)
                                                    pool.get();
                if (!pcPool.isEmpty()) {
                    pc = pcPool.removeFirst();
                }
                if (pc == null) {
                    pc = new PageContextImpl(this);
                }
	    } else {
		pc = new PageContextImpl(this);
	    }
	    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)) {
            LinkedList<PageContext> pcPool = (LinkedList<PageContext>) pool.get();
            pcPool.addFirst(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);
	}