jetty实战2-jsp
1.概述
jetty会将jsp文件编译成servlet然后提供服务,主要原理是在webdefault.xml中,有一个关于jsp的配置
?
jetty用的的jsp-2.1-glassfish的核心类图如下:
?
?
?2.编译2.1 编译过程?
编译的逻辑是(jsp2.1.6.jar),在每次请求JspServlet的service方法中,主要调用
?
private void initJavaCompiler() { Class c = getClassFor("javax.tools.ToolProvider"); if (c != null) { // JDK1.6 c = getClassFor("org.apache.jasper.compiler.Jsr199JavaCompiler"); if (c != null) { try { javaCompiler = (JavaCompiler) c.newInstance(); } catch (Exception ex) { } } } if (javaCompiler == null) { c = getClassFor("org.eclipse.jdt.internal.compiler.Compiler"); if (c != null) { c = getClassFor("org.apache.jasper.compiler.JDTJavaCompiler"); if (c != null) { try { javaCompiler = (JavaCompiler) c.newInstance(); } catch (Exception ex) { } } } } if (javaCompiler == null) { javaCompiler = new AntJavaCompiler(); } javaCompiler.init(ctxt, errDispatcher, jspcMode); }??
4.参考文档1. http://wiki.eclipse.org/Jetty/Howto/Configure_JSP
?