Package org.apache.jasper.compiler

Examples of org.apache.jasper.compiler.Compiler


  }

        if (compilerPath != null)
            javac.setCompilerPath(compilerPath);

        Compiler jspCompiler = new JspCompiler(this);
  jspCompiler.setJavaCompiler(javac);
        
        return jspCompiler;
    }
View Full Code Here


                                                          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();
            throw ex;
        } catch(JasperException ex) {
            throw ex;
        } catch(ClassNotFoundException cex) {
                throw new JasperException(Constants.getString("jsp.error.unable.load"),
View Full Code Here

     */
    public Compiler createCompiler() throws JasperException {
        if (jspCompiler != null ) {
            return jspCompiler;
        }
        jspCompiler = new Compiler(this, jsw);
        return jspCompiler;
    }
View Full Code Here

                initClassLoader( clctxt );
           
            clctxt.setClassLoader(loader);
            clctxt.setClassPath(classPath);

            Compiler clc = clctxt.createCompiler();
            this.setOutputDir( baseDir );

            if( compile ) {
                // Generate both .class and .java
                if( clc.isOutDated() ) {
                    clc.compile();
                }
            } else {
                // Only generate .java, compilation is separated
                // Don't compile if the .class file is newer than the .jsp file
                if( clc.isOutDated(false) ) {
                    clc.generateJava();
                }
            }

            // Generate mapping
            generateWebMapping( file, clctxt );
View Full Code Here

            Thread.currentThread().setContextClassLoader(loader);

            clctxt.setClassLoader(loader);
            clctxt.setClassPath(classPath);

            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
            if( clc.isOutDated(compile) ) {
                if (log.isDebugEnabled()) {
                    log.debug(jspUri + " is out dated, compiling...");
                }

                clc.compile(compile, true);
            }

            // Generate mapping
            generateWebMapping( file, clctxt );
            if ( showSuccess ) {
View Full Code Here

            Thread.currentThread().setContextClassLoader(loader);

            clctxt.setClassLoader(loader);
            clctxt.setClassPath(classPath);

            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
            if( clc.isOutDated(compile) ) {
                clc.compile(compile, true);
            }

            // Generate mapping
            generateWebMapping( file, clctxt );
            if ( showSuccess ) {
View Full Code Here

        jspCompiler.init(this, jsw);
        return jspCompiler;
    }

    protected Compiler createCompiler(String className) {
        Compiler compiler = null;
        try {
            compiler = (Compiler) Class.forName(className).newInstance();
        } catch (InstantiationException e) {
            log.warn(Localizer.getMessage("jsp.error.compiler"), e);
        } catch (IllegalAccessException e) {
View Full Code Here

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

  File javaFile=new File(javaFileName);
 
  // make sure the directory is created
  new File( javaFile.getParent()).mkdirs();
 
  Compiler compiler=new Compiler(ctxt);
  compiler.setMangler( mangler );
  // we will compile ourself
  compiler.setJavaCompiler( null );
 
 
  synchronized ( mangler ) {
      compiler.compile();
  }
  if( debug > 0 ) {
      File f = new File( mangler.getJavaFileName());
      log.log( "Created file : " + f +  " " + f.lastModified());
     
View Full Code Here

        jspCompiler.init(this, jsw);
        return jspCompiler;
    }

    protected Compiler createCompiler(String className) {
        Compiler compiler = null;
        try {
            compiler = (Compiler) Class.forName(className).newInstance();
        } catch (InstantiationException e) {
            log.warn(Localizer.getMessage("jsp.error.compiler"), e);
        } catch (IllegalAccessException e) {
View Full Code Here

TOP

Related Classes of org.apache.jasper.compiler.Compiler

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.