diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-19 07:52:32 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-19 07:52:32 +0000 |
commit | d3700527dbea081802e78cfbc3b6661c3f076dd3 (patch) | |
tree | 8fe95820696a162ec24984c1635b53b9af1c1588 /java/sca/modules/implementation-web-runtime/src/main | |
parent | 13516e275bec701dceb3ed78a2c8e685c4820f4f (diff) |
Simplify implementation-web-runtime by adding a facility to set context attributes to the servlet host
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@745770 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-web-runtime/src/main')
2 files changed, 1 insertions, 58 deletions
diff --git a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/InitServlet.java b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/InitServlet.java deleted file mode 100644 index 074f41453d..0000000000 --- a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/InitServlet.java +++ /dev/null @@ -1,53 +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.implementation.web.runtime;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.GenericServlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-public class InitServlet extends GenericServlet {
- private static final long serialVersionUID = 1L;
-
- private Map<String, Object> attributes = new HashMap<String, Object>();
-
- public void init(ServletConfig config) throws ServletException {
- ServletContext context = config.getServletContext();
- for (String name : attributes.keySet()) {
- context.setAttribute(name, attributes.get(name));
- }
- }
-
- @Override
- public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException {
- throw new IllegalStateException();
- }
-
- public void setAttribute(String name, Object value) {
- attributes.put(name, value);
- }
-}
diff --git a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java index 6a43a4e8ab..663af52877 100644 --- a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java +++ b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java @@ -34,7 +34,6 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService; public class WebImplementationProviderFactory implements ImplementationProviderFactory<WebImplementation> {
private ServletHost servletHost;
- private InitServlet servlet;
public WebImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
@@ -42,13 +41,10 @@ public class WebImplementationProviderFactory implements ImplementationProviderF if (!hosts.isEmpty()) {
this.servletHost = hosts.get(0);
}
-
- servlet = new InitServlet();
}
public ImplementationProvider createImplementationProvider(RuntimeComponent component, WebImplementation implementation) {
- servletHost.addServletMapping("org.apache.tuscany.sca.implementation.web.dummy", servlet);
- servlet.setAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent", component);
+ servletHost.setAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent", component);
return new ImplementationProvider() {
|