summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java')
-rw-r--r--branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java88
1 files changed, 0 insertions, 88 deletions
diff --git a/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java b/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java
deleted file mode 100644
index 29c54b3153..0000000000
--- a/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.tuscany.sca.webapp;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-
-import org.apache.tuscany.sca.http.ServletHost;
-import org.apache.tuscany.sca.http.ServletMappingException;
-
-/**
- * ServletHost impl singleton thats shared between the SCADomain
- * instance and the TuscanyServlet instance.
- * TODO: using a static singleton seems a big hack but how
- * should it be shared? Need some way for TuscanyServlet
- * to pull it out of the SCADomain instance.
- *
- */
-public class WebAppServletHost implements ServletHost {
-
- private static WebAppServletHost instance = new WebAppServletHost();
-
- private Map<String, Servlet> servlets;
-
- private WebAppServletHost() {
- servlets = new HashMap<String, Servlet>();
- }
-
- public void addServletMapping(String path, Servlet servlet) throws ServletMappingException {
- URI pathURI = URI.create(path);
- // for webapps just use the path and ignore the host and port
- servlets.put(pathURI.getPath(), servlet);
- }
-
- public Servlet removeServletMapping(String path) throws ServletMappingException {
- URI pathURI = URI.create(path);
- // for webapps just use the path and ignore the host and port
- return servlets.remove(pathURI.getPath());
- }
-
- public Servlet getServlet(String path) {
- Servlet servlet = servlets.get(path);
- if (servlet != null) {
- return servlet;
- }
- for (String servletPath : servlets.keySet()) {
- if (servletPath.endsWith("*")) {
- if (path.startsWith(servletPath.substring(0, servletPath.length()-1))) {
- return servlets.get(servletPath);
- }
- }
- }
- return null;
- }
-
- public static WebAppServletHost getInstance() {
- return instance;
- }
-
- public void init(ServletConfig config) throws ServletException {
- for (Servlet servlet : servlets.values()) {
- servlet.init(config);
- }
- }
-
-}