Package org.apache.jasper

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


        }
       
        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) {
                    ExceptionUtils.handleThrowable(t);
                    jsw.getServletContext().log("Background compile failed",
                                                t);
                }
View Full Code Here

    {
        JspServletWrapper jsw=(JspServletWrapper) jsps.get(jspUri);
        if( jsw==null ) {
            throw new JasperException("Can't happen - JspServletWrapper=null");
        }
        JspCompilationContext ctxt = new JspEngineContext(loader, classpath,
                                                          context, jspUri,
                                                          isErrorPage, options,
                                                          req, res);
        boolean outDated = false;

        Compiler compiler = null;
        synchronized(jsw){
            /*
             * Creating a compiler opens the associated .class file (if it exists)
             * and reads the actual class name.  If we allow a compiler to be
             * created while a compile is going on then bad things can happen.
             */
            compiler = ctxt.createCompiler();
        }

        try {


            outDated = compiler.isOutDated();
            if(!jsw.isInstantiated() || outDated ) {
                synchronized(jsw){
                    outDated = compiler.compile();
                    if(!jsw.isInstantiated() || outDated) {
                        if( null ==ctxt.getServletClassName() ) {
                            compiler.computeServletClassName();
                        }
                        jsw.instantiateServlet(loader.loadClass(ctxt.getFullClassName()));
                    }
                }
            }
        } catch(FileNotFoundException ex) {
            compiler.removeGeneratedFiles();
View Full Code Here

     */
    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

            throws JasperException {

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

  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

  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

  boolean isErrorPage, HttpServletRequest req, HttpServletResponse res)
  throws JasperException, FileNotFoundException
    {
  Class jspClass = (Class) loadedJSPs.get(name);
  boolean firstTime = jspClass == null;
        JspCompilationContext ctxt = new JspEngineContext(loader, classpath,
                                                     context, name,
                                                     isErrorPage, options,
                                                     req, res);
  boolean outDated = false;

        Compiler compiler = ctxt.createCompiler();
       
        try {
            outDated = compiler.compile();
            if ((jspClass == null) || (compiler.isOutDated())) {
                synchronized ( this ) {
                    if ((jspClass == null) || (compiler.isOutDated() ))
                        outDated = compiler.compile();
                }
            }
        } catch (FileNotFoundException ex) {
            throw ex;
        } catch (JasperException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new JasperException(Constants.getString("jsp.error.unable.compile"),
                                      ex);
        }

  // Reload only if it's outdated
  if((jspClass == null) || outDated) {
      try {
    if( null ==ctxt.getServletClassName() ) {
        compiler.computeServletClassName();
    }
    jspClass = loader.loadClass(ctxt.getFullClassName());
                        //loadClass(ctxt.getFullClassName(), true);
      } catch (ClassNotFoundException cex) {
    throw new JasperException(Constants.getString("jsp.error.unable.load"),
            cex);
      }
View Full Code Here

     */
    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

        }
       
        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

Related Classes of org.apache.jasper.JspCompilationContext

Copyright © 2018 www.massapicom. 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.