summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-01-11 18:02:49 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-01-11 18:02:49 +0000
commite6467f80ce322c2bb649811df23a7db22b4946d0 (patch)
tree51fb2e416b5236913cbb21cad2255bf6026a4225 /sca-java-2.x/trunk
parent3d036eaca5541a27009c5a6a3e1cb2e70abbfc40 (diff)
Tell the ServletHostHelper that the webapp host is being used and use it to locate the host
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@897970 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java22
1 files changed, 2 insertions, 20 deletions
diff --git a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
index 8b6304d863..15ef4023cf 100644
--- a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
+++ b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
@@ -24,16 +24,12 @@ import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.Enumeration;
-import java.util.List;
import javax.servlet.ServletConfig;
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;
import org.apache.tuscany.sca.node.NodeFactory;
import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
@@ -115,6 +111,7 @@ public class ServletHostHelper {
public static ServletHost init(final ServletContext servletContext) {
Node node = (Node)servletContext.getAttribute(SCA_NODE_ATTRIBUTE);
if (node == null) {
+ org.apache.tuscany.sca.host.http.ServletHostHelper.setWebappHost(true);
try {
String domainName = (String)servletContext.getAttribute(DOMAIN_NAME_ATTR);
if (domainName != null) {
@@ -155,22 +152,7 @@ public class ServletHostHelper {
private static WebAppServletHost getServletHost(Node node) {
NodeImpl nodeImpl = (NodeImpl)node;
- ExtensionPointRegistry eps = nodeImpl.getExtensionPoints();
- ServletHostExtensionPoint servletHosts = eps.getExtensionPoint(ServletHostExtensionPoint.class);
- List<ServletHost> hosts = servletHosts.getServletHosts();
- if (hosts == null || hosts.size() < 1) {
- throw new IllegalStateException("No ServletHost found");
- }
- for (ServletHost servletHost : hosts) {
- 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");
+ return (WebAppServletHost) org.apache.tuscany.sca.host.http.ServletHostHelper.getServletHost(nodeImpl.getExtensionPoints());
}
private static Node createNode(final ServletContext servletContext) throws ServletException {