You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/05/24 17:11:57 UTC

svn commit: r1342294 - /openejb/trunk/openejb/tomee/tomee-jaxrs/src/main/java/org/apache/tomee/webservices/TomcatRsRegistry.java

Author: rmannibucau
Date: Thu May 24 15:11:57 2012
New Revision: 1342294

URL: http://svn.apache.org/viewvc?rev=1342294&view=rev
Log:
rest context is not managed by the registry normally

Modified:
    openejb/trunk/openejb/tomee/tomee-jaxrs/src/main/java/org/apache/tomee/webservices/TomcatRsRegistry.java

Modified: openejb/trunk/openejb/tomee/tomee-jaxrs/src/main/java/org/apache/tomee/webservices/TomcatRsRegistry.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-jaxrs/src/main/java/org/apache/tomee/webservices/TomcatRsRegistry.java?rev=1342294&r1=1342293&r2=1342294&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-jaxrs/src/main/java/org/apache/tomee/webservices/TomcatRsRegistry.java (original)
+++ openejb/trunk/openejb/tomee/tomee-jaxrs/src/main/java/org/apache/tomee/webservices/TomcatRsRegistry.java Thu May 24 15:11:57 2012
@@ -52,7 +52,6 @@ public class TomcatRsRegistry implements
 
     private Engine engine;
     private List<Connector> connectors;
-    private final Map<String, Context> contexts = new TreeMap<String, Context>();
     private final Map<String, HttpListener> listeners = new TreeMap<String, HttpListener>();
 
     public TomcatRsRegistry() {
@@ -115,19 +114,6 @@ public class TomcatRsRegistry implements
             throw new IllegalStateException("Invalid context '" + realRoot + "'.  Cannot find context in host " + host.getName());
         }
 
-        context.addLifecycleListener(new LifecycleListener() {
-            public void lifecycleEvent(LifecycleEvent event) {
-                Context context = (Context) event.getLifecycle();
-                if (event.getType().equals(Lifecycle.BEFORE_START_EVENT)) {
-                    context.getServletContext().setAttribute(TomcatWebAppBuilder.IGNORE_CONTEXT, "true");
-                }
-                if (event.getType().equals(Lifecycle.START_EVENT) || event.getType().equals(Lifecycle.BEFORE_START_EVENT) || event.getType().equals("configure_start")) {
-                    context.setConfigured(true);
-                }
-            }
-        });
-
-
         Wrapper wrapper = context.createWrapper();
         final String name = "rest_" + listener.hashCode();
         wrapper.setName(name);
@@ -144,7 +130,6 @@ public class TomcatRsRegistry implements
 
         path = address(connectors, host.getName(), realRoot);
         final String key = address(connectors, host.getName(), completePath);
-        contexts.put(key, context);
         listeners.put(key, listener);
 
         return new AddressInfo(path, key);
@@ -177,20 +162,10 @@ public class TomcatRsRegistry implements
             path = "/" + path;
         }
 
-        if (TomcatHelper.isTomcat7() && TomcatHelper.isStopping() && listeners.containsKey(path)) {
-            return listeners.get(path);
+        // if (TomcatHelper.isTomcat7() && TomcatHelper.isStopping() && listeners.containsKey(path)) {
+        if (listeners.containsKey(path)) {
+            return listeners.remove(path);
         }
-
-        Context context = contexts.remove(path);
-        try {
-            context.stop();
-            context.destroy();
-        } catch (Exception e) {
-            throw new TomEERuntimeException(e);
-        }
-        Host host = (Host) context.getParent();
-        host.removeChild(context);
-
-        return listeners.remove(completePath);
+        return null;
     }
 }