zoukankan      html  css  js  c++  java
  • Tomcat 8

    JDTCompiler.java

    /**
     * Compile the jsp file from the current engine context. As an side- effect,
     * tag files that are referenced by this page are also compiled.
     * 编译 jsp 文件,对应生成 java 文件和 class 文件
     * @param compileClass
     *            If true, generate both .java and .class file If false,
     *            generate only .java file
     */
    void org.apache.jasper.compiler.Compiler.compile(boolean compileClass)
    /**
     * Compile the jsp file into equivalent servlet in .java file
     * 编译 jsp 文件,生成相应的 servlet 的 java文件
     * @return a smap for the current JSP page, if one is generated, null
     *         otherwise
     */
    String[] org.apache.jasper.compiler.Compiler.generateJava()
    /**
     * Compile the servlet from .java file to .class file
     * 将 servlet 的 java 文件编译成 class 文件
     */
    void org.apache.jasper.compiler.JDTCompiler.generateClass(String[] smap)

    JspCompilationContext.java

    /**
     * Full path name of the Java file into which the servlet is being
     * generated.
     * jsp 文件生成对应的 servlet java文件的全路径
     */
    public String getServletJavaFileName() {
        if (servletJavaFileName == null) {
            servletJavaFileName = getOutputDir() + getServletClassName() + ".java";
        }
        return servletJavaFileName;
    }

    SmapUtil.java  写出 jsp 文件对应的 servlet 的 class 文件

    public static void installSmap(String[] smap)
        throws IOException {
        if (smap == null) {
            return;
        }
    
        for (int i = 0; i < smap.length; i += 2) {
            File outServlet = new File(smap[i]);
            SDEInstaller.install(outServlet,
                    smap[i+1].getBytes(StandardCharsets.ISO_8859_1));
        }
    }

    参考:

    http://www.cnblogs.com/mapeng-cnblogs/p/4226005.html
    https://my.oschina.net/heroShane/blog/198450
    https://www.ibm.com/developerworks/cn/java/j-lo-servlet/

  • 相关阅读:
    [Re] Spring-4(SourceCode)
    [Re] Spring-3(JdbcTemplate)
    [Re] Spring-2(IOC+AOP)
    [Re] Spring-1(bean)
    08-MyBatis(2)
    08-传输层(7)
    07-传输层(6)
    06-传输层(5)
    05-传输层(4)
    ALS推荐算法
  • 原文地址:https://www.cnblogs.com/kevin-yuan/p/7444961.html
Copyright © 2011-2022 走看看