@Override protected JspCompilationContext createJspCompilationContext(String name, Options opt, ServletContext sctx, JspRuntimeContext jrctx, ClassLoader classLoader) { JspCompilationContext jcctx = new JspCompilationContext(name, opt, sctx, null, jrctx); jcctx.setClassLoader(classLoader); return jcctx; }
JspC jspc = new JspC(); if (!jspFile.exists()) { return false; jspc.setJspFiles(jspFile.getCanonicalPath()); jspc.setOutputDir(compilationDir.getAbsolutePath()); jspc.setClassName(filename); jspc.setCompile(true); jspc.setClassPath(getClasspathForPlugin(plugin)); jspc.execute();
@Override public String getServletFileNameForJsp(Context context, String jspName) { String servletName = null; ServletConfig servletConfig = (ServletConfig) context.findChild("jsp"); if (servletConfig != null) { ServletContext sctx = context.getServletContext(); Options opt = new EmbeddedServletOptions(servletConfig, sctx); JspRuntimeContext jrctx = new JspRuntimeContext(sctx, opt); JspCompilationContext jcctx = createJspCompilationContext(jspName, opt, sctx, jrctx, null); servletName = jcctx.getServletJavaFileName(); } else { logger.error(NO_JSP_SERVLET, context.getName()); } return servletName; }
/** * @return <code>true</code> if generated code is kept. */ public boolean keepGenerated() { return getOptions().getKeepGenerated(); }
synchronized (servletConfig) { ServletContext sctx = context.getServletContext(); Options opt = new EmbeddedServletOptions(servletConfig, sctx); JspRuntimeContext jrctx = new JspRuntimeContext(sctx, opt); if (item != null) { try { org.apache.jasper.compiler.Compiler compiler = jcctx.createCompiler(); compiler.compile(); item.setState(Item.STATE_READY); item.setException(null); this.logger.error("", e); } finally { jrctx.destroy();
name.endsWith(".jsp") || name.endsWith(".jspx") || opt.getJspConfig().isJspPage(name); } catch (Exception e) { 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);
ServletContext sctx = context.getServletContext(); ServletConfig scfg = (ServletConfig) context.findChild("jsp"); Options opt = new EmbeddedServletOptions(scfg, sctx); String descriptorPageEncoding = opt.getJspConfig().findJspProperty(jspName).getPageEncoding();
synchronized (servletConfig) { ServletContext sctx = context.getServletContext(); Options opt = new EmbeddedServletOptions(servletConfig, sctx); JspRuntimeContext jrctx = new JspRuntimeContext(sctx, opt); try { if (summary.getItems() == null) { jrctx.destroy();
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String jspName = ServletRequestUtils.getStringParameter(request, "source", null); ServletContext sctx = context.getServletContext(); ServletConfig scfg = (ServletConfig) context.findChild("jsp"); Options opt = new EmbeddedServletOptions(scfg, sctx); String encoding = opt.getJavaEncoding(); String content = null; if (jspName != null) { String servletName = getContainerWrapper().getTomcatContainer().getServletFileNameForJsp(context, jspName); if (servletName != null) { File servletFile = new File(servletName); if (servletFile.exists()) { try (InputStream fis = Files.newInputStream(servletFile.toPath())) { content = Utils.highlightStream(jspName, fis, "java", encoding); } } } } return new ModelAndView(getViewName(), "content", content); }
@Override public void jspError(String fname, int line, int column, String errMsg, Exception ex) throws JasperException { throw new JasperException(fname + " (" + JasperMessages.MESSAGES.errorInJspFileLineColumn(line,column) + ") " + errMsg, ex); }
/** * Processes the given javac error report and exception. * * @param errorReport Compilation error report * @param exception Compilation exception */ @Override public void javacError(String errorReport, Exception exception) throws JasperException { throw new JasperException(MESSAGES.failedClassCompilation(), exception); }
/** * Are we keeping generated code around? */ public boolean keepGenerated() { return getOptions().getKeepGenerated(); }
@Override protected JspCompilationContext createJspCompilationContext(String name, Options opt, ServletContext sctx, JspRuntimeContext jrctx, ClassLoader classLoader) { JspCompilationContext jcctx = new JspCompilationContext(name, opt, sctx, null, jrctx); jcctx.setClassLoader(classLoader); return jcctx; }
/** * Are we keeping generated code around? */ public boolean keepGenerated() { return getOptions().getKeepGenerated(); }
@Override protected JspCompilationContext createJspCompilationContext(String name, Options opt, ServletContext sctx, JspRuntimeContext jrctx, ClassLoader classLoader) { JspCompilationContext jcctx = new JspCompilationContext(name, opt, sctx, null, jrctx); jcctx.setClassLoader(classLoader); return jcctx; }
/** * Are we keeping generated code around? */ public boolean keepGenerated() { return getOptions().getKeepGenerated(); }
@Override protected JspCompilationContext createJspCompilationContext(String name, Options opt, ServletContext sctx, JspRuntimeContext jrctx, ClassLoader classLoader) { JspCompilationContext jcctx = new JspCompilationContext(name, opt, sctx, null, jrctx); jcctx.setClassLoader(classLoader); return jcctx; }
/** * Are we keeping generated code around? */ public boolean keepGenerated() { return getOptions().getKeepGenerated(); }
/** * Are we keeping generated code around? */ public boolean keepGenerated() { return getOptions().getKeepGenerated(); }
/** * Are we keeping generated code around? */ public boolean keepGenerated() { return getOptions().getKeepGenerated(); }