Examples of JspServletWrapper


Examples of org.apache.jasper.servlet.JspServletWrapper

     * registered with this class for JSP's.
     */
    private void checkCompile() {
        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.servlet.JspServletWrapper

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

Examples of org.apache.jasper.servlet.JspServletWrapper

            return;
        }
       
        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.servlet.JspServletWrapper

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

Examples of org.apache.jasper.servlet.JspServletWrapper

     * registered with this class for JSP's.
     */
    private void checkCompile() {
        Iterator it = jsps.values().iterator();
        while (it.hasNext()) {
            JspServletWrapper jsw = (JspServletWrapper)it.next();
            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.servlet.JspServletWrapper

        URL baseUrl = new File(info.getWebRoot()).toURL();
        ServletContext sContext = new JspCServletContext(logWriter, baseUrl);
        ServletConfig sConfig = new MockServletConfig(sContext);
        Options options = createOptions(sContext, sConfig, info);
        JspRuntimeContext rtContext = new JspRuntimeContext(sContext, options);
        JspServletWrapper sWrapper = makeWrapper(sContext, options, rtContext);
        JspCompilationContext cContext = createJspCompilationContext(info, sContext, options,
                rtContext, sWrapper, new StringWriter());
        logCompilation(info.getJspSource(), info.getClassOutputDir());
        compileJspToJava(sWrapper, cContext);
        File javaFile = new File(info.getJavaSource());
View Full Code Here

Examples of org.apache.jasper.servlet.JspServletWrapper

    private JspServletWrapper makeWrapper(ServletContext servletContext, Options options,
            JspRuntimeContext jspRuntimeContext) throws MalformedURLException, JasperException {
        TagInfo tagInfo = new MockTagInfo();
        String tagFilePath = "/";
        URL tagFileJarUrl = new File(".").toURL();
        JspServletWrapper wrapper = new JspServletWrapper(servletContext, options, tagFilePath,
                tagInfo, jspRuntimeContext, tagFileJarUrl);
        return wrapper;
    }
View Full Code Here

Examples of org.apache.jasper.servlet.JspServletWrapper

  }

  private void serviceJspFile(HttpServletRequest request,
      HttpServletResponse response, String jspUri, boolean precompile)
      throws ServletException, IOException {
    JspServletWrapper wrapper = rctxt.getWrapper(jspUri);
    if (wrapper == null) {
      synchronized (this) {
        wrapper = rctxt.getWrapper(jspUri);
        if (wrapper == null) {
          wrapper = new JspServletWrapper(config, options, jspUri,
              false, rctxt);
          rctxt.addWrapper(jspUri, wrapper);
        }
        Enumeration<URL> urlEnum = bundleClassLoader.getResources("");
        List<URL> urlList = new ArrayList<URL>();
        while (urlEnum.hasMoreElements()) {
          urlList.add(urlEnum.nextElement());
        }
        wrapper.getJspEngineContext().setClassLoader(
            new URLClassLoader(urlList.toArray(new URL[urlList
                .size()]), bundleClassLoader));
      }
    }

    try {
      wrapper.service(request, response, precompile);
    } catch (FileNotFoundException fnfe) {
      handleMissingResource(request, response, jspUri);
    }

  }
View Full Code Here

Examples of org.apache.jasper.servlet.JspServletWrapper

     * registered with this class for JSP's.
     */
    private void checkCompile() {
        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.servlet.JspServletWrapper

     * registered with this class for JSP's.
     */
    private void checkCompile() {
        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
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.