Update to the servlet host locating code

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@896824 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
antelder 2010-01-07 09:48:34 +00:00
parent 440413e4c6
commit 408ca62008

View file

@ -21,8 +21,10 @@ package org.apache.tuscany.sca.implementation.web.runtime;
import java.util.List;
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.host.webapp.WebAppServletHost;
import org.apache.tuscany.sca.implementation.web.WebImplementation;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
@ -39,8 +41,14 @@ public class WebImplementationProviderFactory implements ImplementationProviderF
public WebImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
List<ServletHost> hosts = servletHosts.getServletHosts();
if (!hosts.isEmpty()) {
this.servletHost = hosts.get(0);
for (ServletHost servletHost : hosts) {
if ("webapp".equals(servletHost.getName())) {
if(servletHost instanceof DefaultServletHostExtensionPoint.LazyServletHost) {
this.servletHost = ((DefaultServletHostExtensionPoint.LazyServletHost) servletHost).getServletHost();
} else if(servletHost instanceof WebAppServletHost) {
this.servletHost = (WebAppServletHost) servletHost;
}
}
}
jsClient = extensionPoints.getExtensionPoint(ClientExtensionPoint.class);