You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2011/01/27 20:34:17 UTC

svn commit: r1064267 - in /geronimo/server/branches/3.0-M2/plugins: jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/GeronimoWebAppContext.java tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

Author: gawor
Date: Thu Jan 27 19:34:17 2011
New Revision: 1064267

URL: http://svn.apache.org/viewvc?rev=1064267&view=rev
Log:
GERONIMO-5788: Expose BundleContext in ServletContext under Spring-named attribute

Modified:
    geronimo/server/branches/3.0-M2/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/GeronimoWebAppContext.java
    geronimo/server/branches/3.0-M2/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

Modified: geronimo/server/branches/3.0-M2/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/GeronimoWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/GeronimoWebAppContext.java?rev=1064267&r1=1064266&r2=1064267&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/GeronimoWebAppContext.java (original)
+++ geronimo/server/branches/3.0-M2/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/GeronimoWebAppContext.java Thu Jan 27 19:34:17 2011
@@ -67,6 +67,7 @@ import org.eclipse.jetty.util.resource.R
 import org.eclipse.jetty.util.resource.URLResource;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
 /**
@@ -97,8 +98,14 @@ public class GeronimoWebAppContext exten
         this.integrationContext = integrationContext;
         setClassLoader(classLoader);
         this.classLoader = classLoader;
-        setAttribute(WebApplicationConstants.BUNDLE_CONTEXT_ATTRIBUTE, integrationContext.getBundle().getBundleContext());
+        setAttribute(WebApplicationConstants.BUNDLE_CONTEXT_ATTRIBUTE, 
+                     integrationContext.getBundle().getBundleContext());
+
         setAttribute(WebAttributeName.WEB_APP_INFO.name(), webAppInfo);
+
+        setAttribute("org.springframework.osgi.web." + BundleContext.class.getName(), 
+                     integrationContext.getBundle().getBundleContext());
+
         // now set the module context ValidatorFactory in a context property.
         try {
             javax.naming.Context ctx = integrationContext.getComponentContext();

Modified: geronimo/server/branches/3.0-M2/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=1064267&r1=1064266&r2=1064267&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/server/branches/3.0-M2/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java Thu Jan 27 19:34:17 2011
@@ -280,6 +280,9 @@ public class TomcatContainer implements 
                                                  contextInfo.getBundle().getBundleContext());
         context.getServletContext().setAttribute(WebAttributeName.WEB_APP_INFO.name(), contextInfo.getWebAppInfo());
 
+        context.getServletContext().setAttribute("org.springframework.osgi.web." + BundleContext.class.getName(), 
+                                                 contextInfo.getBundle().getBundleContext());
+
         // now set the module context ValidatorFactory in a context property.
         try {
             javax.naming.Context ctx = contextInfo.getJndiContext();