java.lang.Object
net.i2p.servlet.util.JspC
Build-time wrapper that calls org.apache.jasper.JspC reflectively and then exits, so the build does not depend on the Jasper API at compile time. The build forks a JVM to run this. Running JspC in-process does not terminate on Tomcat 8.5.33 or 9.0.11 and later, where the JSP compilation is threaded and the thread pool workers are not daemon threads. See https://tomcat.apache.org/tomcat-8.5-doc/changelog.html If the system property build.reproducible is "true", the arguments are rewritten to compile the jsps in a fixed order, and to force a single compiler thread where the jasper in use supports -threadCount, so that the generated web.xml is reproducible. Warning - used in build process only, not included in runtime jars, not for external use. Only for use in build scripts, obviously not a public API. See apps/routerconsole/java/build.xml for more information.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringPath to the Jasper jar, used when the system's own Tomcat is in play.private static final booleanTrue to try to make the generated web.xml byte-for-byte reproducible.private static final booleanTrue to get the Tomcat version out of the jasper jar's manifest instead of ours.private static final StringFirst Tomcat 8.x version to support multiple threads and the -threadCount arg.private static final StringFirst Tomcat 9.x version to support multiple threads and the -threadCount arg.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprivate static Attributesattributes(String f) Jar manifest attributesprivate static voidcollectJspFiles(File dir, List<File> files) Recursively collect the *.jsp files under dir, sorted.private static String[]Only call this if we want reproducible builds.static voidRuns Tomcat JspC with the given arguments, rewriting them when build.reproducible is set.
Field Details
THREADS_VERSION_8
First Tomcat 8.x version to support multiple threads and the -threadCount arg.- See Also:
THREADS_VERSION_9
First Tomcat 9.x version to support multiple threads and the -threadCount arg.- See Also:
REPRODUCIBLE
private static final boolean REPRODUCIBLETrue to try to make the generated web.xml byte-for-byte reproducible.SYSTEM_TOMCAT
private static final boolean SYSTEM_TOMCATTrue to get the Tomcat version out of the jasper jar's manifest instead of ours.JASPER_JAR
Path to the Jasper jar, used when the system's own Tomcat is in play.
Constructor Details
JspC
public JspC()Constructor. The build script drives compilation throughmain(String[]), reading every option from the system properties and arguments, so an instance carries no state.
Method Details
main
Runs Tomcat JspC with the given arguments, rewriting them when build.reproducible is set.- Parameters:
args- arguments forwarded to org.apache.jasper.JspC, afterfixupArgs(String[])- Throws:
IllegalArgumentException- if -webapp is repeated, has no value, or does not name an existing directory; fixupArgs() runs outside the try below
fixupArgs
Only call this if we want reproducible builds. Convert "-webapp dir/" arguments in the args to a sorted list of files, for reproducible builds.- Parameters:
args- the command line arguments to rewrite- Returns:
- args unchanged if there is no -webapp argument, otherwise the rewritten list using -uriroot, one thread, and the sorted JSP file paths
collectJspFiles
attributes
Jar manifest attributes- Parameters:
f- the jar file path whose META-INF/MANIFEST.MF is read- Returns:
- null if not found