37
37
import org .apache .catalina .Wrapper ;
38
38
import org .apache .catalina .connector .Connector ;
39
39
import org .apache .catalina .loader .WebappLoader ;
40
- import org .apache .catalina .startup .TldConfig ;
41
40
import org .apache .catalina .startup .Tomcat ;
42
41
import org .apache .catalina .startup .Tomcat .FixContextListener ;
43
42
import org .apache .coyote .AbstractProtocol ;
@@ -90,13 +89,13 @@ public class TomcatEmbeddedServletContainerFactory extends
90
89
91
90
private String protocol = DEFAULT_PROTOCOL ;
92
91
93
- private static String DEFAULT_NO_TLD_JARS = "tomcat-*.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,"
92
+ private static String DEFAULT_SKIP_JARS = "tomcat-*.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,"
94
93
+ "commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,"
95
94
+ "commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl-*.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant-*.jar,"
96
95
+ "aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools-*.jar,jta*.jar,log4j-*.jar,mail*.jar,slf4j*.jar,"
97
96
+ "xercesImpl-*.jar,xmlParserAPIs-*.jar,xml-apis-*.jar,junit-*.jar,hamcrest*.jar,org.hamcrest*.jar" ;
98
97
99
- private String noTldJars = DEFAULT_NO_TLD_JARS ;
98
+ private String skipJars = DEFAULT_SKIP_JARS ;
100
99
101
100
/**
102
101
* Create a new {@link TomcatEmbeddedServletContainerFactory} instance.
@@ -146,7 +145,7 @@ public EmbeddedServletContainer getEmbeddedServletContainer(
146
145
protected void prepareContext (Host host , ServletContextInitializer [] initializers ) {
147
146
File docBase = getValidDocumentRoot ();
148
147
docBase = (docBase != null ? docBase : createTempDir ("tomcat-docbase" ));
149
- TldConfig . setNoTldJars ( this . noTldJars );
148
+ applySkipJars ( );
150
149
TomcatEmbeddedContext context = new TomcatEmbeddedContext ();
151
150
context .setName (getContextPath ());
152
151
context .setPath (getContextPath ());
@@ -173,6 +172,14 @@ protected void prepareContext(Host host, ServletContextInitializer[] initializer
173
172
postProcessContext (context );
174
173
}
175
174
175
+ private void applySkipJars () {
176
+ // Tomcat 8.0
177
+ System .setProperty ("tomcat.util.scan.StandardJarScanFilter.jarsToSkip" ,
178
+ this .skipJars );
179
+ // Tomcat 7.0
180
+ System .setProperty ("tomcat.util.scan.DefaultJarScanner.jarsToSkip" , this .skipJars );
181
+ }
182
+
176
183
private void addDefaultServlet (Context context ) {
177
184
Wrapper defaultServlet = context .createWrapper ();
178
185
defaultServlet .setName ("default" );
@@ -295,10 +302,10 @@ public void setBaseDirectory(File baseDirectory) {
295
302
* A comma-separated list of jars to ignore for TLD scanning. See Tomcat's
296
303
* catalina.properties for typical values. Defaults to a list drawn from that source.
297
304
*
298
- * @param noTldJars the noTldJars to set
305
+ * @param skipJars the jars to skip when scanning for tlds etc
299
306
*/
300
- public void setNoTldJars (String noTldJars ) {
301
- this .noTldJars = noTldJars ;
307
+ public void setSkipJars (String skipJars ) {
308
+ this .skipJars = skipJars ;
302
309
}
303
310
304
311
/**
0 commit comments