Java Code Examples for org.apache.jasper.Options#getDevelopment()

The following examples show how to use org.apache.jasper.Options#getDevelopment() . 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: JspRuntimeContext.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * Create a JspRuntimeContext for a web application context.
 *
 * Loads in any previously generated dependencies from file.
 *
 * @param context ServletContext for web application
 * @param options The main Jasper options
 */
public JspRuntimeContext(ServletContext context, Options options) {

    this.context = context;
    this.options = options;

    // Get the parent class loader
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    if (loader == null) {
        loader = this.getClass().getClassLoader();
    }

    if (log.isDebugEnabled()) {
        if (loader != null) {
            log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
                                           loader.toString()));
        } else {
            log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
                                           "<none>"));
        }
    }

    parentClassLoader =  loader;
    classpath = initClassPath();

    if (context instanceof org.apache.jasper.servlet.JspCServletContext) {
        codeSource = null;
        permissionCollection = null;
        return;
    }

    if (Constants.IS_SECURITY_ENABLED) {
        SecurityHolder holder = initSecurity();
        codeSource = holder.cs;
        permissionCollection = holder.pc;
    } else {
        codeSource = null;
        permissionCollection = null;
    }

    // If this web application context is running from a
    // directory, start the background compilation thread
    String appBase = context.getRealPath("/");
    if (!options.getDevelopment()
            && appBase != null
            && options.getCheckInterval() > 0) {
        lastCompileCheck = System.currentTimeMillis();
    }

    if (options.getMaxLoadedJsps() > 0) {
        jspQueue = new FastRemovalDequeue<>(options.getMaxLoadedJsps());
        if (log.isDebugEnabled()) {
            log.debug(Localizer.getMessage("jsp.message.jsp_queue_created",
                                           "" + options.getMaxLoadedJsps(), context.getContextPath()));
        }
    }

    /* Init parameter is in seconds, locally we use milliseconds */
    jspIdleTimeout = options.getJspIdleTimeout() * 1000;
}
 
Example 2
Source File: JspRuntimeContext.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * Create a JspRuntimeContext for a web application context.
 *
 * Loads in any previously generated dependencies from file.
 *
 * @param context ServletContext for web application
 */
public JspRuntimeContext(ServletContext context, Options options) {

    this.context = context;
    this.options = options;

    // Get the parent class loader
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    if (loader == null) {
        loader = this.getClass().getClassLoader();
    }

    if (log.isDebugEnabled()) {
        if (loader != null) {
            log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
                                           loader.toString()));
        } else {
            log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
                                           "<none>"));
        }
    }

    parentClassLoader =  loader;
    classpath = initClassPath();

    if (context instanceof org.apache.jasper.servlet.JspCServletContext) {
        codeSource = null;
        permissionCollection = null;
        return;
    }

    if (Constants.IS_SECURITY_ENABLED) {
        SecurityHolder holder = initSecurity();
        codeSource = holder.cs;
        permissionCollection = holder.pc;
    } else {
        codeSource = null;
        permissionCollection = null;
    }

    // If this web application context is running from a
    // directory, start the background compilation thread
    String appBase = context.getRealPath("/");         
    if (!options.getDevelopment()
            && appBase != null
            && options.getCheckInterval() > 0) {
        lastCompileCheck = System.currentTimeMillis();
    }                                            

    if (options.getMaxLoadedJsps() > 0) {
        jspQueue = new FastRemovalDequeue<JspServletWrapper>(options.getMaxLoadedJsps());
        if (log.isDebugEnabled()) {
            log.debug(Localizer.getMessage("jsp.message.jsp_queue_created",
                                           "" + options.getMaxLoadedJsps(), context.getContextPath()));
        }
    }

    /* Init parameter is in seconds, locally we use milliseconds */
    jspIdleTimeout = options.getJspIdleTimeout() * 1000;
}
 
Example 3
Source File: JspRuntimeContext.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * Create a JspRuntimeContext for a web application context.
 *
 * Loads in any previously generated dependencies from file.
 *
 * @param context ServletContext for web application
 */
public JspRuntimeContext(ServletContext context, Options options) {

    this.context = context;
    this.options = options;

    // Get the parent class loader
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    if (loader == null) {
        loader = this.getClass().getClassLoader();
    }

    if (log.isDebugEnabled()) {
        if (loader != null) {
            log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
                                           loader.toString()));
        } else {
            log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
                                           "<none>"));
        }
    }

    parentClassLoader =  loader;
    classpath = initClassPath();

    if (context instanceof org.apache.jasper.servlet.JspCServletContext) {
        codeSource = null;
        permissionCollection = null;
        return;
    }

    if (Constants.IS_SECURITY_ENABLED) {
        SecurityHolder holder = initSecurity();
        codeSource = holder.cs;
        permissionCollection = holder.pc;
    } else {
        codeSource = null;
        permissionCollection = null;
    }

    // If this web application context is running from a
    // directory, start the background compilation thread
    String appBase = context.getRealPath("/");         
    if (!options.getDevelopment()
            && appBase != null
            && options.getCheckInterval() > 0) {
        lastCompileCheck = System.currentTimeMillis();
    }                                            

    if (options.getMaxLoadedJsps() > 0) {
        jspQueue = new FastRemovalDequeue<JspServletWrapper>(options.getMaxLoadedJsps());
        if (log.isDebugEnabled()) {
            log.debug(Localizer.getMessage("jsp.message.jsp_queue_created",
                                           "" + options.getMaxLoadedJsps(), context.getContextPath()));
        }
    }

    /* Init parameter is in seconds, locally we use milliseconds */
    jspIdleTimeout = options.getJspIdleTimeout() * 1000;
}
 
Example 4
Source File: JspRuntimeContext.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
/**
    * Create a JspRuntimeContext for a web application context.
    *
    * Loads in any previously generated dependencies from file.
    *
    * @param context ServletContext for web application
    */
   public JspRuntimeContext(ServletContext context, Options options) {

       this.context = context;
       this.options = options;

       int hashSize = options.getInitialCapacity();
       jsps = new ConcurrentHashMap<String, JspServletWrapper>(hashSize);

       bytecodes = new ConcurrentHashMap<String, byte[]>(hashSize);
       bytecodeBirthTimes = new ConcurrentHashMap<String, Long>(hashSize);
       packageMap = new  ConcurrentHashMap<String, Map<String, JavaFileObject>>();

if (log.isLoggable(Level.FINEST)) {
           ClassLoader parentClassLoader = getParentClassLoader();
    if (parentClassLoader != null) {
	log.finest(Localizer.getMessage("jsp.message.parent_class_loader_is",
				       parentClassLoader.toString()));
    } else {
	log.finest(Localizer.getMessage("jsp.message.parent_class_loader_is",
				       "<none>"));
    }
       }

       initClassPath();

if (context instanceof org.apache.jasper.servlet.JspCServletContext) {
    return;
}

       if (Constants.IS_SECURITY_ENABLED) {
           initSecurity();
       }

       // If this web application context is running from a
       // directory, start the background compilation thread
       String appBase = context.getRealPath("/");         
       if (!options.getDevelopment()
               && appBase != null
               && options.getCheckInterval() > 0
               && !options.getUsePrecompiled()) {
           if (appBase.endsWith(File.separator) ) {
               appBase = appBase.substring(0,appBase.length()-1);
           }
           String directory =
               appBase.substring(appBase.lastIndexOf(File.separator));
           threadName = threadName + "[" + directory + "]";
           threadStart();
       }                                            
   }