org.apache.jasper.compiler.JspRuntimeContext Java Examples

The following examples show how to use org.apache.jasper.compiler.JspRuntimeContext. 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: JspC.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
private void initServletContext() {
    try {
        context =new JspCServletContext
            (new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")),

             new URL("file:" + uriRoot.replace('\\','/') + '/'));
        tldScanner = new TldScanner(context, isValidationEnabled);

        // START GlassFish 750
        taglibs = new ConcurrentHashMap<String, TagLibraryInfo>();
        context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs);

        tagFileJarUrls = new ConcurrentHashMap<String, URL>();
        context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE,
                             tagFileJarUrls);
        // END GlassFish 750
    } catch (MalformedURLException me) {
        System.out.println("**" + me);
    } catch (UnsupportedEncodingException ex) {
    }
    rctxt = new JspRuntimeContext(context, this);
    jspConfig = new JspConfig(context);
    tagPluginManager = new TagPluginManager(context);
}
 
Example #4
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 #5
Source File: JspC.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
protected void initServletContext(ClassLoader classLoader)
        throws IOException, JasperException {
    // TODO: should we use the Ant Project's log?
    PrintWriter log = new PrintWriter(System.out);
    URL resourceBase = new File(uriRoot).getCanonicalFile().toURI().toURL();
    context = new JspCServletContext(log, resourceBase, classLoader);
    if (isValidateTld()) {
        context.setInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM, "true");
    }
    if (isValidateXml()) {
        context.setInitParameter(Constants.XML_VALIDATION_INIT_PARAM, "true");
    }
    context.setInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM,
            String.valueOf(isBlockExternal()));

    tldLocationsCache = TldLocationsCache.getInstance(context);
    rctxt = new JspRuntimeContext(context, this);
    jspConfig = new JspConfig(context);
    tagPluginManager = new TagPluginManager(context);
}
 
Example #6
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 #7
Source File: JspC.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
protected void initServletContext(ClassLoader classLoader)
        throws IOException, JasperException {
    // TODO: should we use the Ant Project's log?
    PrintWriter log = new PrintWriter(System.out);
    URL resourceBase = new File(uriRoot).getCanonicalFile().toURI().toURL();
    context = new JspCServletContext(log, resourceBase, classLoader);
    if (isValidateTld()) {
        context.setInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM, "true");
    }
    if (isValidateXml()) {
        context.setInitParameter(Constants.XML_VALIDATION_INIT_PARAM, "true");
    }
    context.setInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM,
            String.valueOf(isBlockExternal()));

    tldLocationsCache = TldLocationsCache.getInstance(context);
    rctxt = new JspRuntimeContext(context, this);
    jspConfig = new JspConfig(context);
    tagPluginManager = new TagPluginManager(context);
}
 
Example #8
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 #9
Source File: JspCompilationContext.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public JspCompilationContext(String jspUri,
                             Options options,
                             ServletContext context,
                             JspServletWrapper jsw,
                             JspRuntimeContext rctxt) {

    this.jspUri = canonicalURI(jspUri);
    this.options = options;
    this.jsw = jsw;
    this.context = context;

    this.baseURI = jspUri.substring(0, jspUri.lastIndexOf('/') + 1);
    // hack fix for resolveRelativeURI
    if (baseURI == null) {
        baseURI = "/";
    } else if (baseURI.charAt(0) != '/') {
        // strip the base slash since it will be combined with the
        // uriBase to generate a file
        baseURI = "/" + baseURI;
    }
    if (baseURI.charAt(baseURI.length() - 1) != '/') {
        baseURI += '/';
    }

    this.rctxt = rctxt;
    this.tagFileJarUrls = new HashMap<String, JarResource>();
    this.basePackageName = Constants.JSP_PACKAGE_NAME;
}
 
Example #10
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 #11
Source File: JspCompilationContext.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
public JspCompilationContext(String tagfile,
                             TagInfo tagInfo, 
                             Options options,
                             ServletContext context,
                             JspServletWrapper jsw,
                             JspRuntimeContext rctxt,
                             URL tagFileJarUrl)
        throws JasperException {
    this(tagfile, false, options, context, jsw, rctxt);
    this.isTagFile = true;
    this.tagInfo = tagInfo;
    this.tagFileJarUrl = tagFileJarUrl;
}
 
Example #12
Source File: JspCompilationContext.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
public JspCompilationContext(String jspUri,
                             boolean isErrPage,
                             Options options,
                             ServletContext context,
                             JspServletWrapper jsw,
                             JspRuntimeContext rctxt)
        throws JasperException {

    this.jspUri = canonicalURI(jspUri);
    this.isErrPage = isErrPage;
    this.options = options;
    this.jsw = jsw;
    this.context = context;

    this.baseURI = jspUri.substring(0, jspUri.lastIndexOf('/') + 1);
    // hack fix for resolveRelativeURI
    if (baseURI == null) {
        baseURI = "/";
    } else if (baseURI.charAt(0) != '/') {
        // strip the basde slash since it will be combined with the
        // uriBase to generate a file
        baseURI = "/" + baseURI;
    }
    if (baseURI.charAt(baseURI.length() - 1) != '/') {
        baseURI += '/';
    }

    this.rctxt = rctxt;
    this.basePackageName = Constants.JSP_PACKAGE_NAME;

    taglibs = cast(context.getAttribute(Constants.JSP_TAGLIBRARY_CACHE));
    tagFileJarUrls = cast(context.getAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE));
}
 
Example #13
Source File: JspCompilationContext.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private JspCompilationContext(String jspUri, TagInfo tagInfo,
        Options options, ServletContext context, JspServletWrapper jsw,
        JspRuntimeContext rctxt, Jar tagJar, boolean isTagFile) {

    this.jspUri = canonicalURI(jspUri);
    this.options = options;
    this.jsw = jsw;
    this.context = context;

    String baseURI = jspUri.substring(0, jspUri.lastIndexOf('/') + 1);
    // hack fix for resolveRelativeURI
    if (baseURI.isEmpty()) {
        baseURI = "/";
    } else if (baseURI.charAt(0) != '/') {
        // strip the base slash since it will be combined with the
        // uriBase to generate a file
        baseURI = "/" + baseURI;
    }
    if (baseURI.charAt(baseURI.length() - 1) != '/') {
        baseURI += '/';
    }
    this.baseURI = baseURI;

    this.rctxt = rctxt;
    this.basePackageName = Constants.JSP_PACKAGE_NAME;

    this.tagInfo = tagInfo;
    this.tagJar = tagJar;
    this.isTagFile = isTagFile;
}
 
Example #14
Source File: JspCompilationContext.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public JspCompilationContext(String tagfile,
                             TagInfo tagInfo,
                             Options options,
                             ServletContext context,
                             JspServletWrapper jsw,
                             JspRuntimeContext rctxt,
                             JarResource tagJarResource) {
    this(tagfile, options, context, jsw, rctxt);
    this.isTagFile = true;
    this.tagInfo = tagInfo;
    this.tagJarResource = tagJarResource;
}
 
Example #15
Source File: JspCompilationContext.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public JspCompilationContext(String jspUri,
                             Options options,
                             ServletContext context,
                             JspServletWrapper jsw,
                             JspRuntimeContext rctxt) {

    this.jspUri = canonicalURI(jspUri);
    this.options = options;
    this.jsw = jsw;
    this.context = context;

    this.baseURI = jspUri.substring(0, jspUri.lastIndexOf('/') + 1);
    // hack fix for resolveRelativeURI
    if (baseURI.isEmpty()) {
        baseURI = "/";
    } else if (baseURI.charAt(0) != '/') {
        // strip the base slash since it will be combined with the
        // uriBase to generate a file
        baseURI = "/" + baseURI;
    }
    if (baseURI.charAt(baseURI.length() - 1) != '/') {
        baseURI += '/';
    }

    this.rctxt = rctxt;
    this.tagFileJarUrls = new HashMap<String, JarResource>();
    this.basePackageName = Constants.JSP_PACKAGE_NAME;
}
 
Example #16
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 #17
Source File: JspC.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
protected void initServletContext(ClassLoader classLoader)
        throws IOException, JasperException {
    // TODO: should we use the Ant Project's log?
    PrintWriter log = new PrintWriter(System.out);
    URL resourceBase = new File(uriRoot).getCanonicalFile().toURI().toURL();

    context = new JspCServletContext(log, resourceBase, classLoader,
            isValidateXml(), isBlockExternal());
    if (isValidateTld()) {
        context.setInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM, "true");
    }


    initTldScanner(context, classLoader);

    try {
        scanner.scan();
    } catch (SAXException e) {
        throw new JasperException(e);
    }
    tldCache = new TldCache(context, scanner.getUriTldResourcePathMap(),
            scanner.getTldResourcePathTaglibXmlMap());
    context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME, tldCache);
    rctxt = new JspRuntimeContext(context, this);
    jspConfig = new JspConfig(context);
    tagPluginManager = new TagPluginManager(context);
}
 
Example #18
Source File: JspCompilationContext.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public JspCompilationContext(String tagfile,
                             TagInfo tagInfo,
                             Options options,
                             ServletContext context,
                             JspServletWrapper jsw,
                             JspRuntimeContext rctxt,
                             JarResource tagJarResource) {
    this(tagfile, options, context, jsw, rctxt);
    this.isTagFile = true;
    this.tagInfo = tagInfo;
    this.tagJarResource = tagJarResource;
}
 
Example #19
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 #20
Source File: JspCompilationContext.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public JspRuntimeContext getRuntimeContext() {
    return rctxt;
}
 
Example #21
Source File: JspCompilationContext.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public JspRuntimeContext getRuntimeContext() {
    return rctxt;
}
 
Example #22
Source File: JspServlet.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
public void init(ServletConfig config) throws ServletException {

        super.init(config);
        this.config = config;
        this.context = config.getServletContext();

        // Initialize the JSP Runtime Context
        options = new EmbeddedServletOptions(config, context);
        rctxt = new JspRuntimeContext(context,options);

        // START SJSWS 6232180
        // Determine which HTTP methods to service ("*" means all)
        httpMethodsString = config.getInitParameter("httpMethods");
        if (httpMethodsString != null
                && !httpMethodsString.equals("*")) {
            httpMethodsSet = new HashSet<String>();
            StringTokenizer tokenizer = new StringTokenizer(
                    httpMethodsString, ", \t\n\r\f");
            while (tokenizer.hasMoreTokens()) {
                httpMethodsSet.add(tokenizer.nextToken());
            }
        }
        // END SJSWS 6232180

        // START GlassFish 750
        taglibs = new ConcurrentHashMap<String, TagLibraryInfo>();
        context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs);

        tagFileJarUrls = new ConcurrentHashMap<String, URL>();
        context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE, 
                             tagFileJarUrls);
        // END GlassFish 750

        if (log.isLoggable(Level.FINEST)) {
            log.finest(Localizer.getMessage("jsp.message.scratch.dir.is",
                                           options.getScratchDir().toString()));
            log.finest(Localizer.getMessage("jsp.message.dont.modify.servlets"));
        }

        this.jspProbeEmitter = (JspProbeEmitter)
            config.getServletContext().getAttribute(
                "org.glassfish.jsp.monitor.probeEmitter");
    }
 
Example #23
Source File: JspCompilationContext.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public JspCompilationContext(String tagfile, TagInfo tagInfo,
        Options options, ServletContext context, JspServletWrapper jsw,
        JspRuntimeContext rctxt, Jar tagJar) {
    this(tagfile, tagInfo, options, context, jsw, rctxt, tagJar, true);
}
 
Example #24
Source File: JspCompilationContext.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public JspCompilationContext(String jspUri, Options options,
        ServletContext context, JspServletWrapper jsw,
        JspRuntimeContext rctxt) {
    this(jspUri, null, options, context, jsw, rctxt, null, false);
}
 
Example #25
Source File: JspCompilationContext.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
public JspRuntimeContext getRuntimeContext() {
    return rctxt;
}
 
Example #26
Source File: JspCompilationContext.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
public JspRuntimeContext getRuntimeContext() {
    return rctxt;
}