Examples of JspServletWrapper


Examples of org.apache.jasper.servlet.JspServletWrapper

    /** Returns a JspServletWrapper that should be destroyed. Default strategy: Least recently used. */
    public JspServletWrapper getJspForUnload(final int maxLoadedJsps) {
        if( jsps.size() > maxLoadedJsps ) {
            synchronized( jsps ) {
                JspServletWrapper oldest;
                synchronized( jspQueue) {
                    oldest = jspQueue.pop();
                }
                if (oldest != null) {
                    removeWrapper(oldest.getJspUri());
                    return oldest;
                }
            }
        }
        return null;
View Full Code Here

Examples of org.apache.jasper.servlet.JspServletWrapper

   
    /**
     * Checks whether there is a jsp to unload, if one is found, it is destroyed.
     * */
    public boolean unloadJsp() {
        JspServletWrapper jsw = getJspForUnload(options.getMaxLoadedJsps());
        if( null != jsw ) {
            synchronized(jsw) {
                jsw.destroy();
                return true;
            }
        }
        return false;
    }
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

    public boolean handleModification(final String scriptName) {
        if ( log.isDebugEnabled() ) {
            log.debug("Handling modification " + scriptName);
        }

        JspServletWrapper wrapper = jsps.remove(scriptName);

        // first check if jsps contains this
        boolean removed = this.invalidate(wrapper);

        final Set<String> deps;
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

     *
     * @param jspUri JSP URI
     * @param jsw Servlet wrapper for JSP
     */
    public JspServletWrapper addWrapper(final String jspUri, final JspServletWrapper jsw) {
        final JspServletWrapper previous = jsps.putIfAbsent(jspUri, jsw);
        if ( previous == null ) {
            addJspDependencies(jsw, jsw.getDependants());
            return jsw;
        }
        return previous;
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

        }

        final ResourceResolver oldResolver = io.setRequestResourceResolver(resolver);
        jspfh.incUsage();
    try {
      final JspServletWrapper errorJsp = getJspWrapper(scriptName, slingBindings);
      errorJsp.service(slingBindings);

            // The error page could be inside an include.
          final SlingHttpServletRequest request = slingBindings.getRequest();
            final Throwable t = (Throwable)request.getAttribute("javax.servlet.jsp.jspException");
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

        jspfh.incUsage();
        try {
            final SlingBindings slingBindings = new SlingBindings();
            slingBindings.putAll(bindings);

            final JspServletWrapper jsp = getJspWrapper(scriptHelper, slingBindings);
            // create a SlingBindings object
            jsp.service(slingBindings);
        } finally {
            jspfh.decUsage();
            io.resetRequestResourceResolver(oldResolver);
        }
    }
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

    private JspServletWrapper getJspWrapper(final String scriptName, final SlingBindings bindings)
    throws SlingException {
        JspRuntimeContext rctxt = this.getJspRuntimeContext();

      JspServletWrapper wrapper = rctxt.getWrapper(scriptName);
        if (wrapper != null) {
            if ( wrapper.isValid() ) {
                return wrapper;
            }
            synchronized ( this ) {
                rctxt = this.getJspRuntimeContext();
                wrapper = rctxt.getWrapper(scriptName);
                if ( wrapper != null ) {
                    if ( wrapper.isValid() ) {
                        return wrapper;
                    }
                    this.renewJspRuntimeContext();
                    rctxt = this.getJspRuntimeContext();
                }
            }
        }

        wrapper = new JspServletWrapper(servletConfig, options,
                scriptName, false, rctxt, defaultIsSession);
        wrapper = rctxt.addWrapper(scriptName, wrapper);

        return wrapper;
    }
View Full Code Here

Examples of org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

    private void processFile(final String file) throws JasperException {
        ClassLoader originalClassLoader = null;

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

Examples of org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper

        JspRuntimeContext rctxt = ctxt.getRuntimeContext();

        rctxt.lockTagFileLoading(tagFilePath);
        try {

            JspServletWrapper wrapper = rctxt.getWrapper(tagFilePath);

            if (wrapper == null) {
                wrapper = new JspServletWrapper(ctxt.getServletContext(), ctxt
                      .getOptions(), tagFilePath, tagInfo, ctxt
                      .getRuntimeContext(), compiler.getDefaultIsSession(),
                      ctxt.getTagFileJarUrl(tagFilePath));
                wrapper = rctxt.addWrapper(tagFilePath, 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 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(),
                          compiler.getDefaultIsSession(),
                          ctxt.getTagFileJarUrl(tagFilePath));
                    tagClazz = tempWrapper.loadTagFilePrototype();
                    tempVector.add(tempWrapper.getJspEngineContext()
                          .getCompiler());
                } else {
                    tagClazz = wrapper.loadTagFile();
                }
            } finally {
View Full Code Here

Examples of org.apache.sling.scripting.jsp.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
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.