Package org.apache.jasper

Examples of org.apache.jasper.JspEngineContext


    {
        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


  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

    {
        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

                Constants.message("jsp.message.context.classpath",
                                  new Object[] {
                                      classpath == null ? "<none>" : classpath
                                  }, Logger.DEBUG);

            JspCompilationContext ctxt = new JspEngineContext(parentClassLoader,
                                                  classpath, context, jspUri,
                                                  false, options,
                                                  req, res);
            Compiler compiler = ctxt.createCompiler();

            if (checkJSPmods) {
                // set the time that the jsp file has last been checked for
                // being outdated and the JSP last mod time
                lastCheckedTime = System.currentTimeMillis();
View Full Code Here

  throws JasperException, FileNotFoundException
    {
  Class jspClass = (Class) loadedJSPs.get(name);
  boolean firstTime = jspClass == null;

        JspEngineContext ctxt = new JspEngineContext(this, classpath,
                                                     context, name,
                                                     isErrorPage, options,
                                                     req, res);
  boolean outDated = false;

        Compiler compiler = ctxt.createCompiler();
       
        try {
            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 {
    jspClass = loadClass(ctxt.getFullClassName(), true);
      } catch (ClassNotFoundException cex) {
    throw new JasperException(Constants.getString("jsp.error.unable.load"),
            cex);
      }
      loadedJSPs.put(name, jspClass);
View Full Code Here

            }
        } catch(Exception e) {
            throw new JasperException("No output directory: " + e.getMessage());
        }
  boolean firstTime = jsw.servletClass == null;
        JspCompilationContext ctxt = new JspEngineContext(parentClassLoader, classpath,
                                                     context, jspUri, outDir.toString() + File.separator,
                                                     isErrorPage, options,
                                                     req, res);
  boolean outDated = false;

        Compiler compiler = ctxt.createCompiler();
       
        try {
            outDated = compiler.compile();
            if ( (jsw.servletClass == null) || (compiler.isOutDated()) ) {
                synchronized ( this ) {
                    if ((jsw.servletClass == null) ||
      (compiler.isOutDated() ))  {
                        outDated = compiler.compile();
                    }
    }
            }
        } catch (FileNotFoundException ex) {
            compiler.removeGeneratedFiles();
            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((jsw.servletClass == null) || outDated) {
      try {
    URL [] urls = new URL[1];
                File outputDir = new File(normalize(ctxt.getOutputDir()));
                urls[0] = outputDir.toURL();
                jsw.loader = new JasperLoader(urls,ctxt.getServletClassName(),
                parentClassLoader,
                permissionCollection,
                codeSource);
    jsw.servletClass = jsw.loader.loadClass(
      Constants.JSP_PACKAGE_NAME + "." + ctxt.getServletClassName());
      } catch (ClassNotFoundException cex) {
    throw new JasperException(
        Constants.getString("jsp.error.unable.load"),cex);
      } catch (MalformedURLException mue) {
                throw new JasperException(
View Full Code Here

            }
        } catch(Exception e) {
            throw new JasperException("No output directory: " + e.getMessage());
        }
  boolean firstTime = jsw.servletClass == null;
        JspCompilationContext ctxt = new JspEngineContext(parentClassLoader, classpath,
                                                     context, jspUri, outDir.toString() + File.separator,
                                                     isErrorPage, options,
                                                     req, res);
  boolean outDated = false;

        Compiler compiler = ctxt.createCompiler();
       
        try {
            outDated = compiler.compile();
            if ( (jsw.servletClass == null) || (compiler.isOutDated()) ) {
                synchronized ( this ) {
                    if ((jsw.servletClass == null) ||
      (compiler.isOutDated() ))  {
                        outDated = compiler.compile();
                    }
    }
            }
        } catch (FileNotFoundException ex) {
            compiler.removeGeneratedFiles();
            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((jsw.servletClass == null) || outDated) {
      try {
    URL [] urls = new URL[1];
                File outputDir = new File(normalize(ctxt.getOutputDir()));
                urls[0] = outputDir.toURL();
                jsw.loader = new JasperLoader(urls,ctxt.getServletClassName(),
                parentClassLoader,
                permissionCollection,
                codeSource);
    jsw.servletClass = jsw.loader.loadClass(
      Constants.JSP_PACKAGE_NAME + "." + ctxt.getServletClassName());
      } catch (ClassNotFoundException cex) {
    throw new JasperException(
        Constants.getString("jsp.error.unable.load"),cex);
      } catch (MalformedURLException mue) {
                throw new JasperException(
View Full Code Here

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

        Compiler compiler = ctxt.createCompiler();
       
        try {
            outDated = compiler.compile();
            if ( (jsw.servletClass == null) || (compiler.isOutDated()) ) {
                synchronized ( this ) {
                    if ((jsw.servletClass == 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((jsw.servletClass == null) || outDated) {
      try {
    if( null ==ctxt.getServletClassName() ) {
        compiler.computeServletClassName();
    }
    jsw.servletClass = 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

    {
        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

            }
        } catch(Exception e) {
            throw new JasperException("No output directory: " + e.getMessage());
        }
  boolean firstTime = jsw.servletClass == null;
        JspCompilationContext ctxt = new JspEngineContext(parentClassLoader, classpath,
                                                     context, jspUri, outDir.toString() + File.separator,
                                                     isErrorPage, options,
                                                     req, res);
  boolean outDated = false;

        Compiler compiler = ctxt.createCompiler();
       
        try {
            outDated = compiler.compile();
            if ( (jsw.servletClass == null) || (compiler.isOutDated()) ) {
                synchronized ( this ) {
                    if ((jsw.servletClass == null) ||
      (compiler.isOutDated() ))  {
                        outDated = compiler.compile();
                    }
    }
            }
        } catch (FileNotFoundException ex) {
            compiler.removeGeneratedFiles();
            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((jsw.servletClass == null) || outDated) {
      try {
    URL [] urls = new URL[1];
                File outputDir = new File(normalize(ctxt.getOutputDir()));
                urls[0] = outputDir.toURL();
                jsw.loader = new JasperLoader(urls,ctxt.getServletClassName(),
                parentClassLoader,
                permissionCollection,
                codeSource);
    jsw.servletClass = jsw.loader.loadClass(
      Constants.JSP_PACKAGE_NAME + "." + ctxt.getServletClassName());
      } catch (ClassNotFoundException cex) {
    throw new JasperException(
        Constants.getString("jsp.error.unable.load"),cex);
      } catch (MalformedURLException mue) {
                throw new JasperException(
View Full Code Here

TOP

Related Classes of org.apache.jasper.JspEngineContext

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.