try { org.apache.jasper.compiler.Compiler compiler = jcctx.createCompiler(); compiler.compile(); item.setState(Item.STATE_READY); item.setException(null);
/** * This is a protected method intended to be overridden by subclasses of * Compiler. This is used by the compile method to do all the compilation. * @return <code>true</code> if the source generation and compilation * should occur */ public boolean isOutDated() { return isOutDated(true); }
ValidateVisitor(Compiler compiler) { this.pageInfo = compiler.getPageInfo(); this.err = compiler.getErrorDispatcher(); this.ctxt = compiler.getCompilationContext(); this.loader = ctxt.getClassLoader(); }
org.apache.jasper.compiler.Compiler compiler = jcctx.createCompiler(); if (compile) { compiler.compile(); item.setState(Item.STATE_READY); item.setException(null); } else { if (!compiler.isOutDated()) { item.setState(Item.STATE_READY); item.setException(null);
public void compile() throws JasperException, FileNotFoundException { createCompiler(); if (jspCompiler.isOutDated()) { try { jspCompiler.removeGeneratedFiles(); jspLoader = null; jspCompiler.compile(); jsw.setReload(true); jsw.setCompilationException(null); } catch (JasperException ex) { // Cache compilation exception jsw.setCompilationException(ex); if (options.getDevelopment() && options.getRecompileOnFail()) { // Force a recompilation attempt on next access jsw.setLastModificationTest(-1); } throw ex; } catch (Exception ex) { JasperException je = new JasperException(MESSAGES.failedClassCompilation(), ex); // Cache compilation exception jsw.setCompilationException(je); throw je; } } }
String[] smap = generateJava(); if (compileClass) { generateClass(smap);
/** * Removed the java and class files for the tag prototype generated from the * current compilation. * * @param classFileName * If non-null, remove only the class file with with this name. */ public void removeProtoTypeFiles(String classFileName) { for (Compiler c : tempVector) { if (classFileName == null) { c.removeGeneratedClassFiles(); } else if (classFileName.equals(c.getCompilationContext() .getClassFileName())) { c.removeGeneratedClassFiles(); tempVector.remove(c); return; } } } }
public void incrementRemoved() { if (removed > 1) { jspCompiler.removeGeneratedFiles(); if( rctxt != null ) rctxt.removeWrapper(jspUri); } removed++; }
private void appendPageDirective() { buf.append("<").append(JSP_PAGE_DIRECTIVE_ACTION); buf.append("\n"); // append jsp:id buf.append(" ").append(jspIdPrefix).append(":id").append("=\""); buf.append(jspId++).append("\"\n"); buf.append(" ").append("pageEncoding").append("=\"UTF-8\"\n"); buf.append(" ").append("contentType").append("=\""); buf.append(compiler.getPageInfo().getContentType()).append("\"\n"); buf.append("/>\n"); }
public ParserController(JspCompilationContext ctxt, Compiler compiler) { this.ctxt = ctxt; this.compiler = compiler; this.err = compiler.getErrorDispatcher(); }
throw new IllegalStateException(Localizer.getMessage("jsp.error.compiler")); jspCompiler.init(this, jsw); return jspCompiler;
/** * Remove generated files */ public void removeGeneratedFiles() { removeGeneratedClassFiles(); try { File javaFile = new File(ctxt.getServletJavaFileName()); if (log.isDebugEnabled()) { log.debug("Deleting " + javaFile); } if (javaFile.exists()) { if (!javaFile.delete()) { JasperLogger.COMPILER_LOGGER.failedToDeleteGeneratedFile(javaFile); } } } catch (Exception e) { // Remove as much as possible, log possible exceptions JasperLogger.COMPILER_LOGGER.failedToDeleteGeneratedFiles(e); } }
public void compile() throws JasperException, FileNotFoundException { createCompiler(); if (jspCompiler.isOutDated()) { try { jspCompiler.removeGeneratedFiles(); jspLoader = null; jspCompiler.compile(); jsw.setReload(true); jsw.setCompilationException(null); } catch (JasperException ex) { // Cache compilation exception jsw.setCompilationException(ex); if (options.getDevelopment() && options.getRecompileOnFail()) { // Force a recompilation attempt on next access jsw.setLastModificationTest(-1); } throw ex; } catch (Exception ex) { JasperException je = new JasperException( Localizer.getMessage("jsp.error.unable.compile"), ex); // Cache compilation exception jsw.setCompilationException(je); throw je; } } }
String[] smap = generateJava(); File javaFile = new File(ctxt.getServletJavaFileName()); Long jspLastModified = ctxt.getLastModified(ctxt.getJspFile()); javaFile.setLastModified(jspLastModified.longValue()); if (compileClass) { generateClass(smap);
/** * Removed the java and class files for the tag prototype * generated from the current compilation. * @param classFileName If non-null, remove only the class file with * with this name. */ public void removeProtoTypeFiles(String classFileName) { Iterator iter = tempVector.iterator(); while (iter.hasNext()) { Compiler c = (Compiler) iter.next(); if (classFileName == null) { c.removeGeneratedClassFiles(); } else if (classFileName.equals( c.getCompilationContext().getClassFileName())) { c.removeGeneratedClassFiles(); tempVector.remove(c); return; } } } }
public void incrementRemoved() { if (removed > 1) { if(jspCompiler != null) { jspCompiler.removeGeneratedFiles(); } if( rctxt != null ) rctxt.removeWrapper(jspUri); } removed++; }
private void appendPageDirective() { buf.append("<").append(JSP_PAGE_DIRECTIVE_ACTION); buf.append("\n"); // append jsp:id buf.append(" ").append(jspIdPrefix).append(":id").append("=\""); buf.append(jspId++).append("\"\n"); buf.append(" ").append("pageEncoding").append("=\"UTF-8\"\n"); buf.append(" ").append("contentType").append("=\""); buf.append(compiler.getPageInfo().getContentType()).append("\"\n"); buf.append("/>\n"); }
public ParserController(JspCompilationContext ctxt, Compiler compiler) { this.ctxt = ctxt; this.compiler = compiler; this.err = compiler.getErrorDispatcher(); }