You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/01/19 17:28:23 UTC
svn commit: r497864 - in /incubator/tuscany/java/sca/runtime/webapp:
webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/
webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/
webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/
Author: jboynes
Date: Fri Jan 19 08:28:22 2007
New Revision: 497864
URL: http://svn.apache.org/viewvc?view=rev&rev=497864
Log:
bind composite context to application context in webapps
Modified:
incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java
incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java
Modified: incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java?view=diff&rev=497864&r1=497863&r2=497864
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyFilter.java Fri Jan 19 08:28:22 2007
@@ -51,6 +51,9 @@
throw new ServletException("Tuscany is not configured for the web application");
}
context = (CompositeContext) servletContext.getAttribute(CONTEXT_ATTRIBUTE);
+ if (context == null) {
+ throw new ServletException("No context specified");
+ }
}
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain filterChain)
Modified: incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java?view=diff&rev=497864&r1=497863&r2=497864
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java Fri Jan 19 08:28:22 2007
@@ -119,12 +119,14 @@
}
}
context = new CompositeContextImpl(current, getWireService());
+ servletContext.setAttribute(Constants.CONTEXT_ATTRIBUTE, context);
} catch (Exception e) {
throw new ServletLauncherInitException(e);
}
}
public void destroy() {
+ servletContext.removeAttribute(Constants.CONTEXT_ATTRIBUTE);
if (application != null) {
application.stop();
application = null;
Modified: incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java?view=diff&rev=497864&r1=497863&r2=497864
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/test/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImplTestCase.java Fri Jan 19 08:28:22 2007
@@ -22,6 +22,9 @@
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.eq;
+import org.osoa.sca.CompositeContext;
import java.net.URL;
@@ -50,6 +53,7 @@
public void testBootWithDefaults() throws Exception {
expect(context.getResourcePaths("/WEB-INF/tuscany/extensions/")).andReturn(null);
expect(context.getInitParameter("tuscany.currentCompositePath")).andReturn(null);
+ context.setAttribute(eq(Constants.CONTEXT_ATTRIBUTE), isA(CompositeContext.class));
replay(context);
runtime.initialize();
verify(context);
@@ -58,6 +62,7 @@
public void testLazyHttpSessionId() throws Exception {
expect(context.getResourcePaths("/WEB-INF/tuscany/extensions/")).andReturn(null);
expect(context.getInitParameter("tuscany.currentCompositePath")).andReturn(null);
+ context.setAttribute(eq(Constants.CONTEXT_ATTRIBUTE), isA(CompositeContext.class));
replay(context);
runtime.initialize();
verify(context);
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org