summaryrefslogtreecommitdiffstats
path: root/java/sca/distribution/tomcat/tomcat-hook
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/distribution/tomcat/tomcat-hook')
-rw-r--r--java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
index 0d6404fff9..f6aa2203e7 100644
--- a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
+++ b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
@@ -39,33 +39,32 @@ public class TuscanyStandardContext extends StandardContext {
return loader;
}
- initTuscany();
+ if (isSCAAlication()) {
+ initTuscany();
+ }
return super.getLoader();
}
private void initTuscany() {
- String scaVersion = getSCAVersion();
- if ("1.1".equals(scaVersion)) {
- setParentClassLoader(getTuscanyClassloader(scaVersion));
- addApplicationListener("org.apache.tuscany.sca.host.webapp.TuscanyContextListener");
- FilterDef filterDef = new FilterDef();
- filterDef.setFilterName("TuscanyFilter");
- filterDef.setFilterClass("org.apache.tuscany.sca.host.webapp.TuscanyServletFilter");
- addFilterDef(filterDef);
- }
+ setParentClassLoader(getTuscanyClassloader());
+ addApplicationListener("org.apache.tuscany.sca.host.webapp.TuscanyContextListener");
+ FilterDef filterDef = new FilterDef();
+ filterDef.setFilterName("TuscanyFilter");
+ filterDef.setFilterClass("org.apache.tuscany.sca.host.webapp.TuscanyServletFilter");
+ addFilterDef(filterDef);
}
- private String getSCAVersion() {
+ private boolean isSCAAlication() {
Object o = null;
try {
o = getResources().lookup("WEB-INF/web.composite");
} catch (NamingException e) {
}
- return o != null ? "1.1" : null;
+ return o != null;
}
- private ClassLoader getTuscanyClassloader(String version) {
+ private ClassLoader getTuscanyClassloader() {
if (tuscanyClassLoader == null) {
File tuscanyWar = new File(System.getProperty("org.apache.tuscany.sca.tomcat.war"));
File[] runtimeJars = new File(tuscanyWar, "tuscany-lib").listFiles();