org.apache.jasper.Options Java Examples

The following examples show how to use org.apache.jasper.Options. 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: JspServletWrapper.java    From packagedrone with Eclipse Public License 1.0 7 votes vote down vote up
JspServletWrapper(ServletConfig config, Options options, String jspUri,
                     boolean isErrorPage, JspRuntimeContext rctxt)
           throws JasperException {

this.isTagFile = false;
       this.config = config;
       this.options = options;
       this.jspUri = jspUri;
       this.jspProbeEmitter = (JspProbeEmitter)
           config.getServletContext().getAttribute(
               "org.glassfish.jsp.monitor.probeEmitter");

       ctxt = new JspCompilationContext(jspUri, isErrorPage, options,
				 config.getServletContext(),
				 this, rctxt);
       // START PWC 6468930
       String jspFilePath = ctxt.getRealPath(jspUri);
       if (jspFilePath != null) {
           jspFile = new File(jspFilePath);
       }
       // END PWC 6468930
   }
 
Example #2
Source File: JspServletWrapper.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
public JspServletWrapper(ServletContext servletContext,
                         Options options,
                         String tagFilePath,
                         TagInfo tagInfo,
                         JspRuntimeContext rctxt,
                         Jar tagJar) {

    this.isTagFile = true;
    this.config = null;        // not used
    this.options = options;
    this.jspUri = tagFilePath;
    this.tripCount = 0;
    unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
    unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
    unloadAllowed = unloadByCount || unloadByIdle ? true : false;
    ctxt = new JspCompilationContext(jspUri, tagInfo, options,
                                     servletContext, this, rctxt,
                                     tagJar);
}
 
Example #3
Source File: JspServletWrapper.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
public JspServletWrapper(ServletContext servletContext,
                         Options options,
                         String tagFilePath,
                         TagInfo tagInfo,
                         JspRuntimeContext rctxt,
                         JarResource tagJarResource) {

    this.isTagFile = true;
    this.config = null;        // not used
    this.options = options;
    this.jspUri = tagFilePath;
    this.tripCount = 0;
    unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
    unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
    unloadAllowed = unloadByCount || unloadByIdle ? true : false;
    ctxt = new JspCompilationContext(jspUri, tagInfo, options,
                                     servletContext, this, rctxt,
                                     tagJarResource);
}
 
Example #4
Source File: JspServletWrapper.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
public JspServletWrapper(ServletContext servletContext,
                         Options options,
                         String tagFilePath,
                         TagInfo tagInfo,
                         JspRuntimeContext rctxt,
                         JarResource tagJarResource) {

    this.isTagFile = true;
    this.config = null;        // not used
    this.options = options;
    this.jspUri = tagFilePath;
    this.tripCount = 0;
    unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
    unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
    unloadAllowed = unloadByCount || unloadByIdle ? true : false;
    ctxt = new JspCompilationContext(jspUri, tagInfo, options,
                                     servletContext, this, rctxt,
                                     tagJarResource);
}
 
Example #5
Source File: JspServletWrapper.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
public JspServletWrapper(ServletContext servletContext,
		     Options options,
		     String tagFilePath,
		     TagInfo tagInfo,
		     JspRuntimeContext rctxt,
		     URL tagFileJarUrl)
    throws JasperException {

this.isTagFile = true;
       this.config = null;	// not used
       this.options = options;
this.jspUri = tagFilePath;
this.tripCount = 0;
       ctxt = new JspCompilationContext(jspUri, tagInfo, options,
				 servletContext, this, rctxt,
				 tagFileJarUrl);
   }
 
Example #6
Source File: JspServletWrapper.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public JspServletWrapper(ServletConfig config, Options options,
        String jspUri, JspRuntimeContext rctxt) {

    this.isTagFile = false;
    this.config = config;
    this.options = options;
    this.jspUri = jspUri;
    unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
    unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
    unloadAllowed = unloadByCount || unloadByIdle ? true : false;
    ctxt = new JspCompilationContext(jspUri, options,
                                     config.getServletContext(),
                                     this, rctxt);
}
 
Example #7
Source File: JspServletWrapper.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public JspServletWrapper(ServletConfig config, Options options,
        String jspUri, JspRuntimeContext rctxt) {

    this.isTagFile = false;
    this.config = config;
    this.options = options;
    this.jspUri = jspUri;
    unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
    unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
    unloadAllowed = unloadByCount || unloadByIdle ? true : false;
    ctxt = new JspCompilationContext(jspUri, options,
                                     config.getServletContext(),
                                     this, rctxt);
}
 
Example #8
Source File: JspServletWrapper.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public JspServletWrapper(ServletConfig config, Options options,
        String jspUri, JspRuntimeContext rctxt) {

    this.isTagFile = false;
    this.config = config;
    this.options = options;
    this.jspUri = jspUri;
    unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
    unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
    unloadAllowed = unloadByCount || unloadByIdle ? true : false;
    ctxt = new JspCompilationContext(jspUri, options,
                                     config.getServletContext(),
                                     this, rctxt);
}
 
Example #9
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 #10
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 #11
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 #12
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();
       }                                            
   }