Java Code Examples for javax.servlet.jsp.PageContext#initialize()

The following examples show how to use javax.servlet.jsp.PageContext#initialize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JspFactoryImpl.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private PageContext internalGetPageContext(Servlet servlet, ServletRequest request,
        ServletResponse response, String errorPageURL, boolean needsSession,
        int bufferSize, boolean autoflush) {

    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();
    }

    try {
        pc.initialize(servlet, request, response, errorPageURL,
                needsSession, bufferSize, autoflush);
    } catch (IOException ioe) {
        // Implementation never throws IOE but can't change the signature
        // since it is part of the JSP API
    }

    return pc;
}
 
Example 2
Source File: JspFactoryImpl.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private PageContext internalGetPageContext(Servlet servlet, ServletRequest request,
        ServletResponse response, 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) {
        ExceptionUtils.handleThrowable(ex);
        if (ex instanceof RuntimeException) {
            throw (RuntimeException) ex;
        }
        log.fatal("Exception initializing page context", ex);
        return null;
    }
}
 
Example 3
Source File: JspFactoryImpl.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
private PageContext internalGetPageContext(Servlet servlet, ServletRequest request,
        ServletResponse response, 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) {
        ExceptionUtils.handleThrowable(ex);
        if (ex instanceof RuntimeException) {
            throw (RuntimeException) ex;
        }
        log.fatal("Exception initializing page context", ex);
        return null;
    }
}
 
Example 4
Source File: JspFactoryImpl.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
private PageContext internalGetPageContext(Servlet servlet,
			       ServletRequest request,
			       ServletResponse response, 
			       String errorPageURL, 
			       boolean needsSession,
			       int bufferSize, 
			       boolean autoflush) {
      try {
   PageContext pc = null;
   if( USE_POOL ) {
              LinkedList<PageContext> pcPool = 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.log(Level.SEVERE, "Exception initializing page context", ex);
          return null;
      }
  }