Examples of JspCompilationContext


Examples of org.apache.jasper.JspCompilationContext

     * Compiles and loads a tagfile.
     */
    private Class loadTagFile(Compiler compiler, String tagFilePath,
            TagInfo tagInfo, PageInfo parentPageInfo) throws JasperException {

        JspCompilationContext ctxt = compiler.getCompilationContext();
        JspRuntimeContext rctxt = ctxt.getRuntimeContext();
        JspServletWrapper wrapper = (JspServletWrapper) rctxt
                .getWrapper(tagFilePath);

        synchronized (rctxt) {
            if (wrapper == null) {
                wrapper = new JspServletWrapper(ctxt.getServletContext(), ctxt
                        .getOptions(), tagFilePath, tagInfo, ctxt
                        .getRuntimeContext(), ctxt.getTagFileJarUrl(tagFilePath));
                rctxt.addWrapper(tagFilePath, wrapper);

                // Use same classloader and classpath for compiling tag files
                wrapper.getJspEngineContext().setClassLoader(
                        (URLClassLoader) ctxt.getClassLoader());
                wrapper.getJspEngineContext().setClassPath(ctxt.getClassPath());
            } else {
                // Make sure that JspCompilationContext gets the latest TagInfo
                // for the tag file. TagInfo instance was created the last
                // time the tag file was scanned for directives, and the tag
                // file may have been modified since then.
                wrapper.getJspEngineContext().setTagInfo(tagInfo);
            }

            Class tagClazz;
            int tripCount = wrapper.incTripCount();
            try {
                if (tripCount > 0) {
                    // When tripCount is greater than zero, a circular
                    // dependency exists. The circularily dependant tag
                    // file is compiled in prototype mode, to avoid infinite
                    // recursion.

                    JspServletWrapper tempWrapper = new JspServletWrapper(ctxt
                            .getServletContext(), ctxt.getOptions(),
                            tagFilePath, tagInfo, ctxt.getRuntimeContext(),
                            ctxt.getTagFileJarUrl(tagFilePath));
                    tagClazz = tempWrapper.loadTagFilePrototype();
                    tempVector.add(tempWrapper.getJspEngineContext()
                            .getCompiler());
                } else {
                    tagClazz = wrapper.loadTagFile();
View Full Code Here

Examples of org.apache.jasper.JspCompilationContext

        public void visit(Node.CustomTag n) throws JasperException {
            TagFileInfo tagFileInfo = n.getTagFileInfo();
            if (tagFileInfo != null) {
                String tagFilePath = tagFileInfo.getPath();
                JspCompilationContext ctxt = compiler.getCompilationContext();
                if (ctxt.getTagFileJarUrl(tagFilePath) == null) {
                    // Omit tag file dependency info on jar files for now.
                    pageInfo.addDependant(tagFilePath);
                }
                Class c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),
                        pageInfo);
View Full Code Here

Examples of org.apache.jasper.JspCompilationContext

  this.isTagFile = false;
        this.config = config;
        this.options = options;
        this.jspUri = jspUri;
        ctxt = new JspCompilationContext(jspUri, isErrorPage, options,
           config.getServletContext(),
           this, rctxt);
    }
View Full Code Here

Examples of org.apache.jasper.JspCompilationContext

  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);
    }
View Full Code Here

Examples of org.apache.jasper.JspCompilationContext

        }
       
        Object [] wrappers = jsps.values().toArray();
        for (int i = 0; i < wrappers.length; i++ ) {
            JspServletWrapper jsw = (JspServletWrapper)wrappers[i];
            JspCompilationContext ctxt = jsw.getJspEngineContext();
            // JspServletWrapper also synchronizes on this when
            // it detects it has to do a reload
            synchronized(jsw) {
                try {
                    ctxt.compile();
                } catch (FileNotFoundException ex) {
                    ctxt.incrementRemoved();
                } catch (Throwable t) {
                    jsw.getServletContext().log("Background compile failed",
            t);
                }
            }
View Full Code Here

Examples of org.apache.jasper.JspCompilationContext

            wrapperUri = tagFilePath;
        } else {
            wrapperUri = tagJarResouce.getEntry(tagFilePath).toString();
        }

        JspCompilationContext ctxt = compiler.getCompilationContext();
        JspRuntimeContext rctxt = ctxt.getRuntimeContext();

        synchronized (rctxt) {
            JspServletWrapper wrapper = rctxt.getWrapper(wrapperUri);
            if (wrapper == null) {
                wrapper = new JspServletWrapper(ctxt.getServletContext(), ctxt
                        .getOptions(), tagFilePath, tagInfo, ctxt
                        .getRuntimeContext(), tagJarResouce);
                rctxt.addWrapper(wrapperUri, wrapper);

                // Use same classloader and classpath for compiling tag files
                wrapper.getJspEngineContext().setClassLoader(
                        ctxt.getClassLoader());
                wrapper.getJspEngineContext().setClassPath(ctxt.getClassPath());
            } else {
                // Make sure that JspCompilationContext gets the latest TagInfo
                // for the tag file. TagInfo instance was created the last
                // time the tag file was scanned for directives, and the tag
                // file may have been modified since then.
                wrapper.getJspEngineContext().setTagInfo(tagInfo);
            }

            Class<?> tagClazz;
            int tripCount = wrapper.incTripCount();
            try {
                if (tripCount > 0) {
                    // When tripCount is greater than zero, a circular
                    // dependency exists. The circularly dependent tag
                    // file is compiled in prototype mode, to avoid infinite
                    // recursion.

                    JspServletWrapper tempWrapper = new JspServletWrapper(ctxt
                            .getServletContext(), ctxt.getOptions(),
                            tagFilePath, tagInfo, ctxt.getRuntimeContext(),
                            ctxt.getTagFileJarResource(tagFilePath));
                    // Use same classloader and classpath for compiling tag files
                    tempWrapper.getJspEngineContext().setClassLoader(
                            ctxt.getClassLoader());
                    tempWrapper.getJspEngineContext().setClassPath(ctxt.getClassPath());
                    tagClazz = tempWrapper.loadTagFilePrototype();
                    tempVector.add(tempWrapper.getJspEngineContext()
                            .getCompiler());
                } else {
                    tagClazz = wrapper.loadTagFile();
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.JspCompilationContext

        try {
            final String jspUri = file.replace('\\', '/');
            final JspServletWrapper wrapper = new JspServletWrapper(new JspCServletConfig(context), this, jspUri,
                    false, rctxt);

            final JspCompilationContext clctxt = new JspCompilationContext(jspUri,
                false, this, context, wrapper, rctxt);

            // write to a specific servlet package
            clctxt.setServletPackageName(servletPackage);

            originalClassLoader = Thread.currentThread().getContextClassLoader();
            if (loader == null) {
                initClassLoader();
            }
            Thread.currentThread().setContextClassLoader(loader);

            Compiler clc = clctxt.createCompiler();

            // If compile is set, generate both .java and .class, if
            // .jsp file is newer than .class file;
            // Otherwise only generate .java, if .jsp file is newer than
            // the .java file
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.JspCompilationContext

            final boolean defaultIsSession) {
      this.isTagFile = false;
        this.config = config;
        this.options = options;
        this.jspUri = jspUri;
        this.ctxt = new JspCompilationContext(jspUri, isErrorPage, options,
           config.getServletContext(),
           rctxt, defaultIsSession);
        if ( log.isDebugEnabled() ) {
            log.debug("Creating new wrapper for servlet " + jspUri);
        }
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.JspCompilationContext

    throws JasperException {
        this.isTagFile = true;
        this.config = null// not used
        this.options = options;
        this.jspUri = tagFilePath;
        this.ctxt = new JspCompilationContext(jspUri, tagInfo, options,
           servletContext, rctxt, defaultIsSession,
           tagFileJarUrl);
        if ( log.isDebugEnabled() ) {
            log.debug("Creating new wrapper for tagfile " + jspUri);
        }
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.JspCompilationContext

        public void visit(Node.CustomTag n) throws JasperException {
            TagFileInfo tagFileInfo = n.getTagFileInfo();
            if (tagFileInfo != null) {
                String tagFilePath = tagFileInfo.getPath();
                JspCompilationContext ctxt = compiler.getCompilationContext();
                if (ctxt.getTagFileJarUrl(tagFilePath) == null) {
                    // Omit tag file dependency info on jar files for now.
                    pageInfo.addDependant(tagFilePath);
                }
                Class c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),
                        pageInfo);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.