diff options
Diffstat (limited to '')
3 files changed, 29 insertions, 2 deletions
diff --git a/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java b/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java index 1205e86684..2ff16eeac7 100644 --- a/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java +++ b/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java @@ -32,6 +32,7 @@ import javax.servlet.ServletContext; import javax.servlet.ServletException; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.host.http.DefaultServletHostExtensionPoint; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; import org.apache.tuscany.sca.node.Node; @@ -163,8 +164,12 @@ public class ServletHostHelper { throw new IllegalStateException("No ServletHost found"); } for (ServletHost servletHost : hosts) { - if ((servletHost instanceof WebAppServletHost)) { - return (WebAppServletHost)servletHost; + if ("webapp".equals(servletHost.getName())) { + if(servletHost instanceof DefaultServletHostExtensionPoint.LazyServletHost) { + return (WebAppServletHost) ((DefaultServletHostExtensionPoint.LazyServletHost) servletHost).getServletHost(); + } else if(servletHost instanceof WebAppServletHost) { + return (WebAppServletHost) servletHost; + } } } throw new IllegalStateException("No WebApp Servlet host is configured"); diff --git a/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java b/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java index f4315ad07e..7617169b9b 100644 --- a/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java +++ b/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java @@ -67,6 +67,10 @@ public class WebAppServletHost implements ServletHost { public int getDefaultPort() { return defaultPortNumber; } + + public String getName() { + return "webapp"; + } public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException { URI pathURI = URI.create(suri); diff --git a/java/sca/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHost b/java/sca/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHost new file mode 100644 index 0000000000..463ce1e5b2 --- /dev/null +++ b/java/sca/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHost @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ServletHost
+org.apache.tuscany.sca.host.webapp.WebAppServletHost;name=webapp,ranking=0
\ No newline at end of file |