[jboss-svn-commits] JBoss Portal SVN: r5113 - in trunk: cms/src/main/org/jboss/portal/cms/impl/interceptors cms/src/main/org/jboss/portal/cms/impl/jcr cms/src/main/org/jboss/portal/cms/impl/jcr/command cms/src/main/org/jboss/portal/cms/impl/jcr/composite common/src/main/org/jboss/portal/common/invocation common/src/main/org/jboss/portal/test/common core/src/main/org/jboss/portal/core core/src/main/org/jboss/portal/core/api core/src/main/org/jboss/portal/core/aspects/controller core/src/main/org/jboss/portal/core/aspects/server core/src/main/org/jboss/portal/core/cms/command core/src/main/org/jboss/portal/core/command core/src/main/org/jboss/portal/core/command/portlet core/src/main/org/jboss/portal/core/impl/model/instance core/src/main/org/jboss/portal/core/model/instance core/src/main/org/jboss/portal/core/model/portal core/src/main/org/jboss/portal/core/portlet/cms core/src/main/org/jboss/portal/core/portlet/cms/admin core/src/main/org/jboss/portal/test/core/model/instance core/src! /main/org/jboss/portal/test/core/state core/src/resources/portal-cms-sar/META-INF core/src/resources/portal-core-sar/META-INF federation/src/main/org/jboss/portal/federation/impl portlet portlet/src/main/org/jboss/portal/portlet/aspects/portlet portlet/src/main/org/jboss/portal/portlet/container portlet/src/main/org/jboss/portal/portlet/impl/jsr168 portlet/src/main/org/jboss/portal/portlet/impl/spi portlet/src/main/org/jboss/portal/portlet/invocation portlet/src/main/org/jboss/portal/portlet/spi portlet/src/main/org/jboss/portal/portlet/state/producer portlet/src/main/org/jboss/portal/portlet/support/spi portlet/src/main/org/jboss/portal/portlet/tck portlet/src/main/org/jboss/portal/portlet/test portlet/src/main/org/jboss/portal/portlet/test/support portlet/src/main/org/jboss/portal/test/framework/portlet portlet/src/main/org/jboss/portal/test/framework/portlet/actions portlet/src/main/org/jboss/portal/test/framework/portlet/basictests portlet/src/main/org/jboss/portal/test! /portlet/jsr168/api/actionrequest portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionresponse portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletpreferences portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletmode portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequest

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Aug 29 18:35:05 EDT 2006


Author: julien at jboss.com
Date: 2006-08-29 18:30:46 -0400 (Tue, 29 Aug 2006)
New Revision: 5113

Added:
   trunk/common/src/main/org/jboss/portal/common/invocation/AbstractInvocationContext.java
   trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java
   trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStackFactory.java
   trunk/common/src/main/org/jboss/portal/common/invocation/InvocationContext.java
   trunk/common/src/main/org/jboss/portal/common/invocation/InvocationHandler.java
   trunk/common/src/main/org/jboss/portal/common/invocation/Scope.java
   trunk/core/src/main/org/jboss/portal/core/command/portlet/CorePortletInvocationContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
   trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java
   trunk/server/src/main/org/jboss/portal/server/ServerInvocationContextFactory.java
   trunk/server/src/main/org/jboss/portal/server/aspects/server/ControllerInterceptor.java
   trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java
   trunk/server/src/main/org/jboss/portal/server/impl/JBossInterceptorStackFactory.java
   trunk/server/src/main/org/jboss/portal/server/impl/NavigationalStateAttributeResolver.java
   trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java
   trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java
   trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java
   trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
Removed:
   trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreInvocationContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractInvocationContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/spi/InvocationContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/InvocationContextSupport.java
   trunk/server/src/main/org/jboss/portal/server/ServerRequestContext.java
   trunk/server/src/main/org/jboss/portal/server/ServerResponseContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestInvocationContext.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPInvocationContext.java
Modified:
   trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/CacheInterceptor.java
   trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
   trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommand.java
   trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java
   trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java
   trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java
   trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/composite/NewFileCommand.java
   trunk/common/src/main/org/jboss/portal/common/invocation/Interceptor.java
   trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStack.java
   trunk/common/src/main/org/jboss/portal/common/invocation/Invocation.java
   trunk/common/src/main/org/jboss/portal/common/invocation/InvocationException.java
   trunk/common/src/main/org/jboss/portal/test/common/InvocationTestCase.java
   trunk/core/src/main/org/jboss/portal/core/CoreController.java
   trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java
   trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/aspects/server/LocaleInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java
   trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/ExecutionContext.java
   trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowMoveCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/RenderRegionCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/RenderWindowContextCommand.java
   trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreActionContext.java
   trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreRenderContext.java
   trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreUserContext.java
   trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceImpl.java
   trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceSecurityInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
   trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
   trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java
   trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
   trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java
   trunk/core/src/main/org/jboss/portal/test/core/state/StatefulPortletInvokerTestCase.java
   trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
   trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
   trunk/federation/src/main/org/jboss/portal/federation/impl/FederatedPortletInvokerService.java
   trunk/federation/src/main/org/jboss/portal/federation/impl/FederatingPortletInvokerService.java
   trunk/portlet/build.xml
   trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
   trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java
   trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java
   trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/RenderContextSupport.java
   trunk/portlet/src/main/org/jboss/portal/portlet/tck/TCKPortletController.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/TestSecurityInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/UserInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
   trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/Sequence.java
   trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/PortletActionTestAction.java
   trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/basictests/BasicTestSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionrequest/ActionRequestSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionresponse/ActionResponseSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/PortletPreferencesSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletmode/PortletModeSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestsSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java
   trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
   trunk/portlet/src/resources/test-war/WEB-INF/web.xml
   trunk/portlet/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml
   trunk/server/src/main/org/jboss/portal/server/ServerInvocation.java
   trunk/server/src/main/org/jboss/portal/server/ServerRequest.java
   trunk/server/src/main/org/jboss/portal/server/ServerResponse.java
   trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
   trunk/server/src/main/org/jboss/portal/server/aspects/server/LocaleInterceptor.java
   trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java
   trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java
   trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java
   trunk/server/src/main/org/jboss/portal/server/navigation/NavigationalStateContext.java
   trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
   trunk/server/src/main/org/jboss/portal/test/server/charset/GetTest.java
   trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataNoCharsetTest.java
   trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataUTF8Test.java
   trunk/server/src/main/org/jboss/portal/test/server/charset/PostTest.java
   trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedNoCharsetTest.java
   trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedUTF8Test.java
   trunk/server/src/main/org/jboss/portal/test/server/parameters/GetTest.java
   trunk/server/src/main/org/jboss/portal/test/server/parameters/PostApplicationXWWWFormURLEncodedTest.java
   trunk/server/src/main/org/jboss/portal/test/server/parameters/PostMultipartFormDataTest.java
   trunk/server/src/main/org/jboss/portal/test/server/servlet/DefaultServletMappingTest.java
   trunk/server/src/main/org/jboss/portal/test/server/servlet/PathMappingTest.java
   trunk/server/src/main/org/jboss/portal/test/server/servlet/RootPathMappingTest.java
   trunk/server/src/main/org/jboss/portal/test/server/session/SessionTest.java
   trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml
   trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml
   trunk/server/src/resources/test/test-servlet-defaultservletmapping-war/WEB-INF/web.xml
   trunk/server/src/resources/test/test-servlet-pathmapping-war/WEB-INF/web.xml
   trunk/server/src/resources/test/test-servlet-rootpathmapping-war/WEB-INF/web.xml
   trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml
   trunk/server/src/resources/test/test-session-sar/META-INF/jboss-service.xml
   trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java
   trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java
   trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java
   trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
   trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
   trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java
   trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java
   trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java
   trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
   trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java
   trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java
   trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/aspects/portlet/SessionInterceptor.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
   trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
   trunk/wsrp/src/resources/test-wsrp-producer-sar/META-INF/jboss-service.xml
Log:
reapplying changes of last week end.

Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/CacheInterceptor.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/CacheInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/CacheInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -34,7 +34,6 @@
 import org.jboss.portal.cms.impl.jcr.command.DeleteCommand;
 import org.jboss.portal.cms.impl.jcr.command.FileGetCommand;
 import org.jboss.portal.cms.impl.jcr.composite.UpdateFileCommand;
-import org.jboss.portal.cms.model.Content;
 import org.jboss.portal.cms.model.File;
 import org.jboss.portal.common.invocation.InvocationException;
 
@@ -43,12 +42,12 @@
  */
 public class CacheInterceptor extends CMSInterceptor
 {
-   
+
    private CMSTreeCacheService cache;
-   
+
    public Logger log = Logger.getLogger(CacheInterceptor.class);
-   
-   
+
+
    private void loadCache()
    {
       try
@@ -69,7 +68,7 @@
       {
          loadCache();
       }
-      
+
       if (invocation instanceof DeleteCommand)
       {
          // delete from cache

Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -50,12 +50,15 @@
 import org.jboss.portal.cms.model.File;
 import org.jboss.portal.cms.model.Folder;
 import org.jboss.portal.cms.util.RepositoryUtil;
-import org.jboss.portal.common.invocation.InterceptorStack;
 import org.jboss.portal.common.net.URLNavigator;
 import org.jboss.portal.common.net.URLVisitor;
 import org.jboss.portal.common.system.AbstractJBossService;
 import org.jboss.portal.common.util.Tools;
 import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.InvocationHandler;
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.util.StopWatch;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
@@ -81,10 +84,19 @@
    private String homeDir;
    private String repositoryName;
    
-   private InterceptorStack cmsStack;
+   private InterceptorStackFactory stackFactory;
    
    private Element config;
 
+   private InvocationHandler handler = new InvocationHandler()
+   {
+      public void invoke(Invocation invocation) throws Exception, InvocationException
+      {
+         JCRCommand cmd = (JCRCommand)invocation;
+         cmd.dispatch();
+      }
+   };
+
    public JCRCMS()
    {
       commandFactory = new JCRCommandFactory();
@@ -427,9 +439,11 @@
          jcrCmd.setContext(ctx);
          
          
-         if ((cmsStack != null) && (cmsStack.getInterceptors().length != 0))
+         if ((stackFactory != null) && (stackFactory.getInterceptorStack().getLength() != 0))
          {
-            jcrCmd.invoke(cmsStack.getInterceptors());
+            jcrCmd.setHandler(handler);
+            jcrCmd.invoke(stackFactory.getInterceptorStack());
+            jcrCmd.setHandler(null);
          }
          else
          {
@@ -482,13 +496,13 @@
       return obj;
    }
 
-   public void setCmsStack(InterceptorStack cmsStack)
+   public void setStackFactory(InterceptorStackFactory stackFactory)
    {
-      this.cmsStack = cmsStack;
+      this.stackFactory = stackFactory;
    }
 
-   public InterceptorStack getCmsStack()
+   public InterceptorStackFactory getStackFactory()
    {
-      return cmsStack;
+      return stackFactory;
    }
 }

Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -26,6 +26,7 @@
 import org.jboss.portal.cms.Command;
 import org.jboss.portal.cms.CMSException;
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationContext;
 
 
 /**
@@ -34,30 +35,30 @@
  * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
  * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  */
-public abstract class JCRCommand extends Command implements Serializable 
+public abstract class JCRCommand extends Command implements Serializable
 {
    public static String JCR_SESSION_ATTRIBUTE = "org.jboss.portal.cms.jcr.session";
    public static String JCR_COMMANDFATORY_ATTRIBUTE = "org.jboss.portal.cms.jcr.commandfactory";
    public static String JCR_LOCALE_ATTRIBUTE = "org.jboss.portal.cms.jcr.locale";
-   
+
    protected JCRCommandContext context;
-   
+
    private Object result;
-   
-   public JCRCommandContext getContext()
+
+   public InvocationContext getContext()
    {
       return context;
    }
-   
+
    public void setContext(JCRCommandContext context)
    {
       this.context = context;
    }
-   
+
    public abstract Object execute() throws CMSException;
-   
+
    protected void dispatch() throws Exception, InvocationException
-   {  
+   {
       Object object = execute();
       setResult(object);
    }
@@ -66,7 +67,7 @@
    {
       return result;
    }
-      
+
    public void setResult(Object result)
    {
       this.result = result;

Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -22,6 +22,7 @@
 package org.jboss.portal.cms.impl.jcr;
 
 import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
 
 import java.util.Locale;
 
@@ -31,7 +32,7 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class JCRCommandContext
+public class JCRCommandContext extends AbstractInvocationContext
 {
 
    private final Session session;

Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -30,6 +30,7 @@
 import org.apache.jackrabbit.value.StringValue;
 import org.jboss.portal.cms.CMSMimeMappings;
 import org.jboss.portal.cms.impl.jcr.JCRCommand;
+import org.jboss.portal.cms.impl.jcr.JCRCommandContext;
 import org.jboss.portal.cms.model.File;
 
 /**
@@ -51,7 +52,8 @@
    {
       try
       {
-         Node fileNode = (Node) getContext().getSession().getItem(mFile.getBasePath());
+         JCRCommandContext context = (JCRCommandContext)getContext();
+         Node fileNode = (Node) context.getSession().getItem(mFile.getBasePath());
 
          Node contentNode = fileNode.addNode(mFile.getContent().getLocale().getLanguage(), "portalcms:content");
          contentNode.setProperty("jcr:encoding", "UTF-8");
@@ -79,9 +81,9 @@
             }
          }
          contentNode.addMixin("mix:versionable");
-         
+
          // Save this for other sessions.
-         getContext().getSession().save();
+         context.getSession().save();
          }
       catch(Exception e)
       {

Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -37,7 +37,7 @@
 
    public ItemExistsCommand(String sPath)
    {
-      setAttribute("path", sPath);
+      // setAttribute("path", sPath);
       this.msPath = sPath;
    }
 

Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/composite/NewFileCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/composite/NewFileCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/composite/NewFileCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -40,8 +40,8 @@
 
    public NewFileCommand(File file, Content content)
    {
-      setAttribute("file", file);
-      setAttribute("content", content);
+      // setAttribute("file", file);
+      // setAttribute("content", content);
       Command saveFileCMD = new FileCreateCommand(file);
       commands.add(saveFileCMD);
       Command saveContentCMD = new ContentCreateCommand(file);

Added: trunk/common/src/main/org/jboss/portal/common/invocation/AbstractInvocationContext.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/AbstractInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/AbstractInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,104 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.common.invocation;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractInvocationContext implements InvocationContext
+{
+
+   /** . */
+   private final Map resolvers;
+
+   public AbstractInvocationContext()
+   {
+      this.resolvers = new HashMap();
+   }
+
+   protected final void addResolver(Scope resolverScope, InvocationContext federatedContext)
+   {
+      resolvers.put(resolverScope, federatedContext);
+   }
+
+   protected final void addResolver(Scope resolverScope, AttributeResolver resolver)
+   {
+      resolvers.put(resolverScope, resolver);
+   }
+
+   public AttributeResolver getAttributeResolver(Scope attrScope) throws IllegalArgumentException
+   {
+      if (attrScope == null)
+      {
+         throw new IllegalArgumentException("Attribute name must not be null");
+      }
+      AttributeResolver resolver = null;
+      Object o = resolvers.get(attrScope);
+      if (o instanceof AttributeResolver)
+      {
+         resolver = (AttributeResolver)o;
+      }
+      else if (o instanceof InvocationContext)
+      {
+         InvocationContext federaredContext = (InvocationContext)o;
+         resolver = federaredContext.getAttributeResolver(attrScope);
+      }
+      return resolver;
+   }
+
+   public Object getAttribute(Scope attrScope, String attrName) throws IllegalArgumentException
+   {
+      if (attrName == null)
+      {
+         throw new IllegalArgumentException("Attribute name must not be null");
+      }
+      AttributeResolver resolver = getAttributeResolver(attrScope);
+      if (resolver == null)
+      {
+         throw new IllegalArgumentException("Scope not recognized " + attrScope);
+      }
+      return resolver.getAttribute(attrName);
+   }
+
+   public void setAttribute(Scope attrScope, String attrName, Object attrValue) throws IllegalArgumentException
+   {
+      if (attrName == null)
+      {
+         throw new IllegalArgumentException("Attribute name must not be null");
+      }
+      AttributeResolver resolver = getAttributeResolver(attrScope);
+      if (resolver == null)
+      {
+         throw new IllegalArgumentException("Scope not recognized " + attrScope);
+      }
+      resolver.setAttribute(attrName, attrValue);
+   }
+
+   public void removeAttribute(Scope attrScope, String attrName)
+   {
+      setAttribute(attrScope, attrName, null);
+   }
+}

Added: trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.common.invocation;
+
+/**
+ * An attribute resolver.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface AttributeResolver
+{
+   /**
+    * Return an attribute from this resolver.
+    *
+    * @param attrName the attribute name
+    * @throws IllegalArgumentException if the attribute name is null
+    * @return the attribute value or null if it is not found
+    */
+   Object getAttribute(String attrName) throws IllegalArgumentException;
+
+   /**
+    * Update an attribute value on this resolve. If the attribute value is null
+    * the resolver must treat the operation as a removal of the attribute.
+    *
+    * @param attrName the attribute name
+    * @param attrValue the attribute value
+    * @throws IllegalArgumentException if the attribute name is null
+    */
+   void setAttribute(String attrName, Object attrValue) throws IllegalArgumentException;
+}

Modified: trunk/common/src/main/org/jboss/portal/common/invocation/Interceptor.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/Interceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/Interceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -28,7 +28,7 @@
 public interface Interceptor
 {
    /**
-    * Apply the aspect on this invocation.
+    * todo
     */
    void invoke(Invocation invocation) throws Exception, InvocationException;
 }

Modified: trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStack.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStack.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStack.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -32,7 +32,18 @@
 public interface InterceptorStack
 {
    /**
+    * Returns the stack length.
     *
+    * @return the length
     */
-   Interceptor[] getInterceptors();
+   int getLength();
+
+   /**
+    * Return the interceptor at the specified index.
+    *
+    * @param index the interceptor index in the stack
+    * @return the specified interceptor
+    * @throws ArrayIndexOutOfBoundsException if the index is not valid
+    */
+   Interceptor getInterceptor(int index) throws ArrayIndexOutOfBoundsException;
 }

Added: trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStackFactory.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStackFactory.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/InterceptorStackFactory.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.common.invocation;
+
+import org.jboss.portal.common.invocation.InterceptorStack;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface InterceptorStackFactory
+{
+   InterceptorStack getInterceptorStack();
+}

Modified: trunk/common/src/main/org/jboss/portal/common/invocation/Invocation.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/Invocation.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/Invocation.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,8 @@
 */
 package org.jboss.portal.common.invocation;
 
-import java.util.Map;
-import java.util.HashMap;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.common.invocation.InterceptorStack;
 
 /**
  * A generic invocation object.
@@ -34,93 +34,80 @@
 {
 
    /** . */
-   private static final Interceptor[] EMPTY_INTERCEPTORS = new Interceptor[0];
+   public static final InterceptorStack EMPTY_STACK = new InterceptorStack()
+   {
+      public int getLength()
+      {
+         return 0;
+      }
+      public Interceptor getInterceptor(int index) throws ArrayIndexOutOfBoundsException
+      {
+         throw new ArrayIndexOutOfBoundsException();
+      }
+   };
 
    /** The current index in the chain. */
    private int currentIndex = 0;
 
    /** The current interceptor stack. */
-   private Interceptor[] currentInterceptors = EMPTY_INTERCEPTORS;
+   private InterceptorStack currentStack = Invocation.EMPTY_STACK;
 
-   /** The invocation attributes. */
-   private Map attributes;
+   /** . */
+   private InvocationHandler handler;
 
-   public Invocation()
-   {
-      attributes = null;
-   }
-
    /**
-    * Set an attribute on the invocation. The goal of attributes is to exchange data between interceptors.
-    * Indeed they could use the underlying request to exchange informations but it is preferrable to not
-    * put such objects visible in the request as they are private to the aspects.
+    * Return the invocation context or throw IllegalStateException.
     *
-    * @param name the attribute name
-    * @param value the attribute value
-    * @throws IllegalArgumentException if the attribute name is null
+    * @return the invocation context
+    * @throws IllegalStateException if no context is associated with this invocation
     */
-   public void setAttribute(String name, Object value) throws IllegalArgumentException
+   public abstract InvocationContext getContext() throws IllegalStateException;
+
+   /**
+    * @see InvocationContext#getAttribute(Scope, String)
+    */
+   public Object getAttribute(Scope attrScope, String attrName) throws IllegalArgumentException
    {
-      if (name == null)
-      {
-         throw new IllegalArgumentException("Attribute name must not be null");
-      }
-      if (attributes == null)
-      {
-         attributes = new HashMap();
-      }
-      if (value == null)
-      {
-         attributes.remove(name);
-      }
-      else
-      {
-         attributes.put(name, value);
-      }
+      return getContext().getAttribute(attrScope, attrName);
    }
 
    /**
-    * Remove an attribute from the invocation.
-    *
-    * @param name the attribute name
-    * @throws IllegalArgumentException if the name is null
+    * @see InvocationContext#setAttribute(Scope, String, Object)
     */
-   public void removeAttribute(String name) throws IllegalArgumentException
+   public void setAttribute(Scope attrScope, String attrName, Object attrValue) throws IllegalArgumentException
    {
-      setAttribute(name, null);
+      getContext().setAttribute(attrScope, attrName, attrValue);
    }
 
    /**
-    * Return an attribute from the invocation.
-    *
-    * @param name the attribute name
-    * @return the attribute value
-    * @throws IllegalArgumentException if the name is null
+    * @see InvocationContext#removeAttribute(Scope, String)
     */
-   public Object getAttribute(String name) throws IllegalArgumentException
+   public void removeAttribute(Scope attrScope, String attrName) throws IllegalArgumentException
    {
-      if (name == null)
-      {
-         throw new IllegalArgumentException("Attribute name must not be null");
-      }
-      if (attributes == null)
-      {
-         return null;
-      }
-      return attributes.get(name);
+      getContext().removeAttribute(attrScope, attrName);
    }
 
+   public InvocationHandler getHandler()
+   {
+      return handler;
+   }
+
+   public void setHandler(InvocationHandler handler)
+   {
+      this.handler = handler;
+   }
+
    /**
     * Invoke the next interceptor in the chain. If the end of the chain is reached then the <code>dispatch()</code>
     * is invoked.
     */
    public void invokeNext() throws Exception, InvocationException
    {
-      if (currentIndex < currentInterceptors.length)
+      if (currentIndex < currentStack.getLength())
       {
          try
          {
-            Interceptor interceptor = currentInterceptors[currentIndex++];
+            Interceptor interceptor = currentStack.getInterceptor(currentIndex++);
             if (interceptor == null)
             {
                throw new InvocationException("Null interceptor at index=" + (currentIndex - 1));
@@ -137,34 +124,35 @@
       }
       else
       {
-         dispatch();
+         if (handler == null)
+         {
+            throw new InvocationException("No handler");
+         }
+         else
+         {
+            handler.invoke(this);
+         }
       }
    }
 
    /**
     * Execute the invocation through the chain of interceptors.
-    * <code>InvocationException</code> should be raised for checked exception.
-    * <code>InvocationRuntimeException</code> should be raised for for non checked exception.
-    * <code>RuntimeException</code> should not be raised and are considered to be programmation errors when they go through
-    * the chain, so any code in the chain should not throw instances of <code>RuntimeException</code>.
-    *
-    * When the end of the chain is reached the <code>dispatch()</code> method is invoked.
     */
-   public void invoke(Interceptor[] newInterceptors) throws Exception, InvocationException
+   public void invoke(InterceptorStack newStack) throws Exception, InvocationException
    {
-      if (newInterceptors == null)
+      if (newStack == null)
       {
          throw new InvocationException("Cannot invoke with a null interceptor[]");
       }
 
       // Save the previous context
-      Interceptor[] previousInterceptors = currentInterceptors;
+      InterceptorStack previousInterceptors = currentStack;
       int previousIndex = currentIndex;
 
       try
       {
          // Set the new context
-         currentInterceptors = newInterceptors;
+         currentStack = newStack;
          currentIndex = 0;
 
          // Perform invoke
@@ -173,16 +161,8 @@
       finally
       {
          // Restablish the previous context
-         currentInterceptors = previousInterceptors;
+         currentStack = previousInterceptors;
          currentIndex = previousIndex;
       }
    }
-
-   /**
-    * Dispatch the call to the target.
-    */
-   protected abstract void dispatch() throws Exception, InvocationException;
 }
-
-
-

Added: trunk/common/src/main/org/jboss/portal/common/invocation/InvocationContext.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/InvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/InvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.common.invocation;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface InvocationContext
+{
+   /**
+    * Return the attribute resolver of this context.
+    *
+    * @param attrScope the  attribute resolver scope
+    * @return the attribute resolver or null if not found
+    * @throws IllegalArgumentException if the attribute scope is null
+    */
+   AttributeResolver getAttributeResolver(Scope attrScope) throws IllegalArgumentException;
+
+   /**
+    * Returns an attribute value.
+    *
+    * @param attrScope the attribute scope
+    * @param attrName the attribute name
+    * @return the attribute value or null if not found
+    * @throws IllegalArgumentException if the attribute name or the attribute scope is null
+    */
+   Object getAttribute(Scope attrScope, String attrName) throws IllegalArgumentException;
+
+   /**
+    * Update an attribute value.
+    *
+    * @param attrScope the attribute scope
+    * @param attrName the attribute name
+    * @param attrValue the attribute value
+    * @throws IllegalArgumentException if the attribute name of the attribute scope is null
+    */
+   void setAttribute(Scope attrScope, String attrName, Object attrValue) throws IllegalArgumentException;
+
+   /**
+    * Remove an attribute value. If the attribute value is null
+    * the resolver must treat the operation as a removal of the attribute.
+    *
+    * @param attrName the attribute name
+    * @throws IllegalArgumentException if the name is null
+    */
+   void removeAttribute(Scope attrScope, String attrName);
+}

Modified: trunk/common/src/main/org/jboss/portal/common/invocation/InvocationException.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/InvocationException.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/InvocationException.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -27,6 +27,7 @@
  */
 public class InvocationException extends RuntimeException
 {
+
    /** The serialVersionUID */
    private static final long serialVersionUID = 7607329736844391861L;
 

Added: trunk/common/src/main/org/jboss/portal/common/invocation/InvocationHandler.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/InvocationHandler.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/InvocationHandler.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.common.invocation;
+
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface InvocationHandler
+{
+   /**
+    *
+    */
+   void invoke(Invocation invocation) throws Exception, InvocationException;
+}

Added: trunk/common/src/main/org/jboss/portal/common/invocation/Scope.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/Scope.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/Scope.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,72 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.common.invocation;
+
+/**
+ * The scope of an attribute.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Scope
+{
+
+   /** The value. */
+   private final String value;
+
+   /**
+    * @param value the scope value
+    * @throws IllegalArgumentException if the value is null
+    */
+   public Scope(String value) throws IllegalArgumentException
+   {
+      if (value == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      this.value = value;
+   }
+
+   public int hashCode()
+   {
+      return value.hashCode();
+   }
+
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+      {
+         return true;
+      }
+      if (obj instanceof Scope)
+      {
+         Scope that = (Scope)obj;
+         return value.equals(that.value);
+      }
+      return false;
+   }
+
+   public String toString()
+   {
+      return value;
+   }
+}

Modified: trunk/common/src/main/org/jboss/portal/test/common/InvocationTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/InvocationTestCase.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/common/src/main/org/jboss/portal/test/common/InvocationTestCase.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -33,107 +33,107 @@
 public class InvocationTestCase extends TestCase
 {
 
-   public void testInvokeThrowsIllegalArgumentException()
-   {
-      Invocation inv = new Invocation()
-      {
-         protected void dispatch()
-         {
-            fail("Dispatch should not be called");
-         }
-      };
-      try
-      {
-         inv.invoke(null);
-         fail("Calling invoke with null should throw an exception");
-      }
-      catch (Exception expected)
-      {
-         assertTrue(expected instanceof InvocationException);
-      }
-      try
-      {
-         inv.invoke(new Interceptor[]{null});
-         fail("Calling invoke with an array containing null should throw an exception");
-      }
-      catch (Exception expected)
-      {
-         assertTrue(expected instanceof InvocationException);
-      }
-   }
+//   public void testInvokeThrowsIllegalArgumentException()
+//   {
+//      Invocation inv = new Invocation()
+//      {
+//         protected void dispatch()
+//         {
+//            fail("Dispatch should not be called");
+//         }
+//      };
+//      try
+//      {
+//         inv.invoke(null);
+//         fail("Calling invoke with null should throw an exception");
+//      }
+//      catch (Exception expected)
+//      {
+//         assertTrue(expected instanceof InvocationException);
+//      }
+//      try
+//      {
+//         inv.invoke(new Interceptor[]{null});
+//         fail("Calling invoke with an array containing null should throw an exception");
+//      }
+//      catch (Exception expected)
+//      {
+//         assertTrue(expected instanceof InvocationException);
+//      }
+//   }
+//
+//   public void testCallDispatch() throws Exception
+//   {
+//      final StringBuffer tmp = new StringBuffer();
+//      Invocation inv = new Invocation()
+//      {
+//         protected void dispatch()
+//         {
+//            tmp.append("3");
+//         }
+//      };
+//      inv.invoke(new Interceptor[]
+//      {
+//         new Interceptor()
+//         {
+//            public void invoke(Invocation invocation) throws Exception, InvocationException
+//            {
+//               tmp.append("1");
+//               invocation.invokeNext();
+//               tmp.append("5");
+//            }
+//         } ,
+//         new Interceptor()
+//         {
+//            public void invoke(Invocation invocation) throws Exception, InvocationException
+//            {
+//               tmp.append("2");
+//               invocation.invokeNext();
+//               tmp.append("4");
+//            }
+//         }
+//      });
+//      assertEquals("12345", tmp.toString());
+//   }
+//
+//   public void testInterceptorThrowingException() throws Exception
+//   {
+//      final StringBuffer tmp = new StringBuffer();
+//      Invocation inv = new Invocation()
+//      {
+//         protected void dispatch()
+//         {
+//            tmp.append("3");
+//         }
+//      };
+//      try
+//      {
+//         inv.invoke(new Interceptor[]
+//         {
+//            new Interceptor()
+//            {
+//               public void invoke(Invocation invocation) throws Exception, InvocationException
+//               {
+//                  tmp.append("1");
+//                  invocation.invokeNext();
+//                  tmp.append("5");
+//               }
+//            } ,
+//            new Interceptor()
+//            {
+//               public void invoke(Invocation invocation) throws Exception, InvocationException
+//               {
+//                  tmp.append("2");
+//                  throw new InvocationException();
+//               }
+//            }
+//         });
+//         fail("Should not be here");
+//      }
+//      catch (InvocationException expected)
+//      {
+//      }
+//      assertEquals("12", tmp.toString());
+//   }
 
-   public void testCallDispatch() throws Exception
-   {
-      final StringBuffer tmp = new StringBuffer();
-      Invocation inv = new Invocation()
-      {
-         protected void dispatch()
-         {
-            tmp.append("3");
-         }
-      };
-      inv.invoke(new Interceptor[]
-      {
-         new Interceptor()
-         {
-            public void invoke(Invocation invocation) throws Exception, InvocationException
-            {
-               tmp.append("1");
-               invocation.invokeNext();
-               tmp.append("5");
-            }
-         } ,
-         new Interceptor()
-         {
-            public void invoke(Invocation invocation) throws Exception, InvocationException
-            {
-               tmp.append("2");
-               invocation.invokeNext();
-               tmp.append("4");
-            }
-         }
-      });
-      assertEquals("12345", tmp.toString());
-   }
-
-   public void testInterceptorThrowingException() throws Exception
-   {
-      final StringBuffer tmp = new StringBuffer();
-      Invocation inv = new Invocation()
-      {
-         protected void dispatch()
-         {
-            tmp.append("3");
-         }
-      };
-      try
-      {
-         inv.invoke(new Interceptor[]
-         {
-            new Interceptor()
-            {
-               public void invoke(Invocation invocation) throws Exception, InvocationException
-               {
-                  tmp.append("1");
-                  invocation.invokeNext();
-                  tmp.append("5");
-               }
-            } ,
-            new Interceptor()
-            {
-               public void invoke(Invocation invocation) throws Exception, InvocationException
-               {
-                  tmp.append("2");
-                  throw new InvocationException();
-               }
-            }
-         });
-         fail("Should not be here");
-      }
-      catch (InvocationException expected)
-      {
-      }
-      assertEquals("12", tmp.toString());
-   }
-
 }

Modified: trunk/core/src/main/org/jboss/portal/core/CoreController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/CoreController.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/CoreController.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,16 +21,20 @@
 */
 package org.jboss.portal.core;
 
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
 import org.jboss.portal.common.system.AbstractJBossService;
-import org.jboss.portal.common.invocation.InterceptorStack;
+import org.jboss.portal.core.command.CommandException;
+import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.command.ErrorResultException;
+import org.jboss.portal.core.command.ExecutionContext;
+import org.jboss.portal.core.command.ObjectNotFoundException;
 import org.jboss.portal.core.command.mapper.CommandFactory;
-import org.jboss.portal.core.command.*;
 import org.jboss.portal.core.command.mapper.URLFactory;
 import org.jboss.portal.core.model.instance.InstanceContainer;
 import org.jboss.portal.core.model.portal.PortalObjectContainer;
 import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerException;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerException;
 import org.jboss.portal.server.ServerURL;
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.theme.page.PageService;
@@ -50,7 +54,7 @@
    private PageService pageService;
    private CommandFactory commandFactory;
    private URLFactory urlFactory;
-   private InterceptorStack commandStack;
+   private InterceptorStackFactory stackFactory;
    private PortalObjectContainer portalObjectContainer;
    private InstanceContainer instanceContainer;
 
@@ -104,25 +108,25 @@
       this.pageService = pageService;
    }
 
-   public InterceptorStack getCommandStack()
+   public InterceptorStackFactory getStackFactory()
    {
-      return commandStack;
+      return stackFactory;
    }
 
-   public void setCommandStack(InterceptorStack commandStack)
+   public void setStackFactory(InterceptorStackFactory stackFactory)
    {
-      this.commandStack = commandStack;
+      this.stackFactory = stackFactory;
    }
 
    public void handle(ServerInvocation invocation) throws ServerException
    {
-      URLContext urlContext = invocation.getRequest().getContext().getURLContext();
+      URLContext urlContext = invocation.getServerContext().getURLContext();
       ExecutionContext ec = new ExecutionContext(this, invocation);
 
       ControllerCommand cmd = null;
       try
       {
-         cmd = commandFactory.doMapping(invocation, invocation.getRequest().getContext().getPortalContextPath(), invocation.getRequest().getContext().getPortalRequestPath());
+         cmd = commandFactory.doMapping(invocation, invocation.getServerContext().getPortalContextPath(), invocation.getServerContext().getPortalRequestPath());
          ec.execute(cmd );
       }
       catch (org.jboss.portal.core.command.SecurityException e)
@@ -157,7 +161,7 @@
    {
       try
       {
-         HttpServletResponse resp = invocation.getResponse().getContext().getClientResponse();
+         HttpServletResponse resp = invocation.getServerContext().getClientResponse();
          resp.sendError(sc);
       }
       catch (IOException e)
@@ -170,7 +174,7 @@
    {
       try
       {
-         HttpServletResponse resp = invocation.getResponse().getContext().getClientResponse();
+         HttpServletResponse resp = invocation.getServerContext().getClientResponse();
          resp.sendRedirect(redirect);
       }
       catch (IOException e)

Modified: trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -29,7 +29,7 @@
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.core.command.InvokeWindowRenderCommand;
 import org.jboss.portal.core.command.RenderPageCommand;
-import org.jboss.portal.core.command.portlet.CoreInvocationContext;
+import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -145,7 +145,7 @@
 
       public String toString()
       {
-         CoreInvocationContext ctx = (CoreInvocationContext)invocation.getContext();
+         CorePortletInvocationContext ctx = (CorePortletInvocationContext)invocation.getContext();
          InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(handle, null, null, parameters);
          URLContext info = getURLContext();
          return ctx.encodeURL(cmd, info, relative);
@@ -162,7 +162,7 @@
 
       public String toString()
       {
-         CoreInvocationContext ctx = (CoreInvocationContext)invocation.getContext();
+         CorePortletInvocationContext ctx = (CorePortletInvocationContext)invocation.getContext();
          RenderPageCommand cmd = new RenderPageCommand(handle);
          URLContext urlContext = getURLContext();
          return ctx.encodeURL(cmd, urlContext, relative);

Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -28,6 +28,7 @@
 import org.jboss.portal.core.command.InvokeWindowRenderCommand;
 import org.jboss.portal.core.command.InvokeWindowActionCommand;
 import org.jboss.portal.core.command.WindowCommand;
+import org.jboss.portal.core.command.CommandContext;
 import org.jboss.portal.core.api.JBossPortalNode;
 import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.portlet.ParametersStateString;
@@ -164,7 +165,8 @@
       //
       if (redirection != null)
       {
-         cmd.getContext().forward(redirection);
+         CommandContext ctx = (CommandContext)cmd.getContext();
+         ctx.forward(redirection);
       }
       else
       {

Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -3,6 +3,7 @@
 import org.apache.log4j.Logger;
 import org.jboss.portal.Mode;
 import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.core.command.CommandContext;
 import org.jboss.portal.core.command.CommandInterceptor;
@@ -14,7 +15,6 @@
 import org.jboss.portal.core.model.portal.PortalObject;
 import org.jboss.portal.core.model.portal.Window;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.server.util.HTTPStreamInfo;
 import org.jboss.portal.theme.LayoutInfo;
 import org.jboss.portal.theme.LayoutService;
@@ -45,6 +45,7 @@
  */
 public class PageNavigationInterceptor extends CommandInterceptor
 {
+
    private static final Logger log = Logger.getLogger(PageNavigationInterceptor.class);
 
    public void invoke(ControllerCommand cmd) throws Exception, InvocationException
@@ -67,9 +68,10 @@
 
          try
          {
-            ServerInvocation sinv = cmd.getContext().getExecutionContext().getServerInvocation();
-            NavigationalStateContext navCtx = sinv.getRequest().getNavigationContext();
-            ensurePageNavigationalState(navCtx, cmd, page);
+            ServerInvocation sinv = ((CommandContext)cmd.getContext()).getExecutionContext().getServerInvocation();
+            LayoutService layoutService = ((CommandContext)cmd.getContext()).getExecutionContext().getController().getPageService().getLayoutService();
+            AttributeResolver navCtx = cmd.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
+            ensurePageNavigationalState(layoutService, navCtx, sinv, page);
          }
          catch (StrategyException e)
          {
@@ -80,28 +82,30 @@
       cmd.invokeNext();
    }
 
-   public static void updatePageNavigationalState(CommandContext cmdContext,
+   public static void updatePageNavigationalState(LayoutService layoutService, CommandContext cmdContext,
                                                   ServerInvocation sinv, Portal portal, Page page, Window window,
                                                   Mode mode, WindowState windowState) throws StrategyException
    {
       if (window != null)
       {
          // First update the window navigational state
-         NavigationalStateContext navCtx = sinv.getRequest().getNavigationContext();
+         AttributeResolver navCtx = sinv.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
 
          // now take care of the page navigational state (i.e. fire the layout strategy with the window navigational state change,
          // and honor what the strategy has to say to the change (if anything)
-         PageNavigationalState pageNavState = ensurePageNavigationalState(navCtx, cmdContext.getCommand(), page);
+         PageNavigationalState pageNavState = ensurePageNavigationalState(layoutService, navCtx, sinv, page);
 
          // get the position of the portlet on the page, and other window location related state
          WindowContext windowContext = pageNavState.getWindowContext(window.getId());
-         PortalLayout layout = getLayout(cmdContext, page);
+
+         PortalLayout layout = getLayout(layoutService, page);
+
          LayoutStrategy strategy = getLayoutStrategy(page, layout, sinv);
 
          HTTPStreamInfo streamInfo = sinv.getResponse().getStreamInfo();
          Set windowStates = portal.getSupportedWindowStates();
          Set portletModes = portal.getSupportedModes();
-         HttpServletRequest httpRequest = sinv.getRequest().getContext().getClientRequest();
+         HttpServletRequest httpRequest = sinv.getServerContext().getClientRequest();
          StrategyContext strategyContext = new StrategyContext(navCtx, pageNavState, httpRequest, streamInfo, windowStates, portletModes, layout.getLayoutInfo().getRegionNames());
 
          NavigationalStateChangedEvent event = new NavigationalStateChangedEvent(windowContext, mode, windowState);
@@ -150,13 +154,12 @@
       return strategy;
    }
 
-   private static PortalLayout getLayout(CommandContext context, Page page)
+   private static PortalLayout getLayout(LayoutService layoutService, Page page)
    {
-      LayoutService layoutService = context.getExecutionContext().getController().getPageService().getLayoutService();
       return MarkupCommand.getLayout(layoutService, page);
    }
 
-   private static void processResponse(NavigationalStateContext navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse, PortalLayout layout)
+   private static void processResponse(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse, PortalLayout layout)
    {
       //             handle excluded portlets
       handleExcludedPortlets(pageNavState, strategyResponse);
@@ -171,9 +174,9 @@
       handleLayoutAndState(navCtx, pageNavState, strategyResponse, layout);
    }
 
-   private static PageNavigationalState ensurePageNavigationalState(NavigationalStateContext navCtx, ControllerCommand cmd, Page page) throws StrategyException
+   private static PageNavigationalState ensurePageNavigationalState(LayoutService layoutService, AttributeResolver navCtx, ServerInvocation sinv, Page page) throws StrategyException
    {
-      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getNavigationalState(page.getId());
+      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
 
       if (pageNavState != null)
       {
@@ -183,12 +186,12 @@
       // Create the page nav state
       Map windowContexts = createWindowContextMap(page);
 
-      pageNavState = (PageNavigationalState)navCtx.getNavigationalState(page.getId());
+      pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
       if (pageNavState == null)
       {
          //
          pageNavState = new PageNavigationalState();
-         navCtx.setNavigationalState(page.getId(), pageNavState);
+         navCtx.setAttribute(page.getId(), pageNavState);
 
          // Initialize the window missing NS
 //         for (Iterator i = windowContexts.values().iterator(); i.hasNext();)
@@ -207,8 +210,7 @@
       // evaluate the layout strategy
 
       // get the layout to use
-      ServerInvocation sinv = cmd.getContext().getExecutionContext().getServerInvocation();
-      PortalLayout layout = getLayout(cmd.getContext(), page);
+      PortalLayout layout = getLayout(layoutService, page);
 
       if (layout == null)
       {
@@ -223,7 +225,7 @@
       HTTPStreamInfo streamInfo = sinv.getResponse().getStreamInfo();
       Set windowStates = portal.getSupportedWindowStates();
       Set portletModes = portal.getSupportedModes();
-      HttpServletRequest httpRequest = sinv.getRequest().getContext().getClientRequest();
+      HttpServletRequest httpRequest = sinv.getServerContext().getClientRequest();
       StrategyContext strategyContext = new StrategyContext(navCtx, pageNavState, httpRequest, streamInfo, windowStates, portletModes, layout.getLayoutInfo().getRegionNames());
 
       // call the strategy
@@ -232,7 +234,7 @@
       // update the navigational state from the strategy response (if requested therein)
       processResponse(navCtx, pageNavState, strategyResponse, layout);
 
-      navCtx.setNavigationalState(page.getId(), pageNavState);
+      navCtx.setAttribute(page.getId(), pageNavState);
 
       return pageNavState;
    }
@@ -317,7 +319,7 @@
       return null;
    }
 
-   private static void handleLayoutAndState(NavigationalStateContext navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse, PortalLayout layout)
+   private static void handleLayoutAndState(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse, PortalLayout layout)
    {
       pageNavState.setLayoutState(strategyResponse.getLayoutState());
 
@@ -356,7 +358,7 @@
          {
             pageNavState.setWindowRegion(windowId, ctx.getRegionName(), false);
             pageNavState.setWindowOrder(windowId, ctx.getOrder(), false);
-            WindowNavigationalState windowNavState = (WindowNavigationalState)navCtx.getNavigationalState(windowId + "_window");
+            WindowNavigationalState windowNavState = (WindowNavigationalState)navCtx.getAttribute(windowId + "_window");
             windowNavState.setWindowState((WindowState)idsToRestore.get(windowId));
          }
       }
@@ -367,7 +369,7 @@
     *
     * @param strategyResponse
     */
-   private static void handleWindowStateChanges(NavigationalStateContext navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse)
+   private static void handleWindowStateChanges(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse)
    {
 
       Map changeMap = strategyResponse.getWindowStateChangeMap();
@@ -379,7 +381,7 @@
          // only if the portlet is part of this request (and the portlet is still registered) do we allow for the change
          if (windowContexts.contains(windowContext))
          {
-            WindowNavigationalState state = (WindowNavigationalState)navCtx.getNavigationalState(windowContext.getId() + "_window");
+            WindowNavigationalState state = (WindowNavigationalState)navCtx.getAttribute(windowContext.getId() + "_window");
             state.setWindowState((WindowState)changeMap.get(windowContext));
          }
          else
@@ -389,7 +391,7 @@
       }
    }
 
-   private static void handlePortletModeChanges(NavigationalStateContext navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse)
+   private static void handlePortletModeChanges(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse)
    {
       Map changeMap = strategyResponse.getPortletModeChangeMap();
       Collection windowContexts = pageNavState.getWindowContexts();
@@ -400,7 +402,7 @@
          // only if the portlet is part of this request do we allow for the change
          if (windowContexts.contains(windowContext))
          {
-            WindowNavigationalState state = (WindowNavigationalState)navCtx.getNavigationalState(windowContext.getId() + "_window");
+            WindowNavigationalState state = (WindowNavigationalState)navCtx.getAttribute(windowContext.getId() + "_window");
             state.setMode((Mode)changeMap.get(windowContext));
          }
          else

Modified: trunk/core/src/main/org/jboss/portal/core/aspects/server/LocaleInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/server/LocaleInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/server/LocaleInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.core.aspects.server;
 
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.identity.User;
 import org.jboss.portal.server.ServerInterceptor;
 import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.identity.User;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Locale;
-import java.util.List;
-import java.util.ArrayList;
 
 /**
  * If the user is authenticated and has a preferred locale then this one is chosen.
@@ -62,7 +62,7 @@
 
       // Get the locale from the user agent.
       ServerRequest req = invocation.getRequest();
-      locales.add(req.getContext().getClientRequest().getLocale());
+      locales.add(invocation.getServerContext().getClientRequest().getLocale());
 
       try
       {

Modified: trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,24 +21,24 @@
 */
 package org.jboss.portal.core.aspects.server;
 
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.core.CoreConstants;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
 import org.jboss.portal.server.ServerInterceptor;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.identity.UserModule;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.NoSuchUserException;
-import org.jboss.logging.Logger;
 
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSessionBindingEvent;
 import javax.servlet.http.HttpSessionBindingListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-import java.util.Date;
 import java.io.Serializable;
 import java.security.Principal;
+import java.util.Date;
 
 /**
  * The interceptor is responsible for managing the user identity lifecycle based
@@ -72,7 +72,7 @@
    protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
    {
       boolean trace = log.isTraceEnabled();
-      HttpServletRequest req = invocation.getRequest().getContext().getClientRequest();
+      HttpServletRequest req = invocation.getServerContext().getClientRequest();
       HttpSession httpSession = req.getSession();
 
       // Get the id

Modified: trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -71,7 +71,7 @@
    public void execute() throws InvocationException
    {
       ServerInvocation serverInvocation = context.getExecutionContext().getServerInvocation();
-      HttpServletResponse resp = serverInvocation.getResponse().getContext().getClientResponse();
+      HttpServletResponse resp = serverInvocation.getServerContext().getClientResponse();
 
       try
       {

Modified: trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -24,14 +24,14 @@
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.common.invocation.InterceptorStack;
-import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
 import org.jboss.portal.core.CoreController;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class CommandContext
+public class CommandContext extends AbstractInvocationContext
 {
 
    /** The command executed within this context. */
@@ -43,32 +43,26 @@
    /** Depth of the forward chain. */
 //   protected int forwardDepth;
 
-   public CommandContext(ControllerCommand command)
+   public CommandContext(ExecutionContext executionContext, ControllerCommand command)
    {
-      if (command == null)
+      if (executionContext == null)
       {
          throw new IllegalArgumentException();
       }
-      this.command = command;
-   }
-
-   void setExecutionContext(ExecutionContext executionContext)
-   {
-      if (executionContext != null)
+      if (command == null)
       {
-         if (this.executionContext != null)
-         {
-            throw new IllegalStateException();
-         }
+         throw new IllegalArgumentException();
       }
-      else
-      {
-         if (this.executionContext == null)
-         {
-            throw new IllegalStateException();
-         }
-      }
+
+      //
       this.executionContext = executionContext;
+      this.command = command;
+
+      //
+      addResolver(ControllerCommand.REQUEST_SCOPE, executionContext.getServerInvocation().getContext());
+      addResolver(ControllerCommand.SESSION_SCOPE, executionContext.getServerInvocation().getContext());
+      addResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, executionContext.getServerInvocation().getContext());
+      addResolver(ControllerCommand.PRINCIPAL_SCOPE, executionContext.getServerInvocation().getContext());
    }
 
    public ExecutionContext getExecutionContext()
@@ -95,11 +89,10 @@
 
          // Execute
          CoreController controller = executionContext.getController();
-         InterceptorStack commandStack = controller.getCommandStack();
-         Interceptor[] commandInterceptors = commandStack.getInterceptors();
+         InterceptorStack commandStack = controller.getStackFactory().getInterceptorStack();
 
          //
-         command.invoke(commandInterceptors);
+         command.invoke(commandStack);
       }
       catch (Exception e)
       {
@@ -138,14 +131,7 @@
 
    public void chain(ControllerCommand nextCommand) throws CommandException
    {
-      if (nextCommand == null)
-      {
-         throw new IllegalArgumentException();
-      }
-
-      //
-      CommandContext nextCommandContext = new CommandContext(nextCommand);
-      executionContext.execute(nextCommandContext);
+      executionContext.chain(nextCommand);
    }
 
    public String toString()

Modified: trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -24,6 +24,9 @@
 import org.jboss.logging.Logger;
 import org.jboss.portal.common.invocation.Invocation;
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.invocation.Scope;
+import org.jboss.portal.common.invocation.InvocationHandler;
 import org.jboss.portal.security.PortalSecurityException;
 import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
 
@@ -35,16 +38,38 @@
  */
 public abstract class ControllerCommand extends Invocation
 {
+
    /** . */
+   public static final Scope PRINCIPAL_SCOPE = new Scope("principal");
+
+   /** . */
+   public static final Scope SESSION_SCOPE = new Scope("session");
+
+   /** . */
+   public static final Scope REQUEST_SCOPE = new Scope("request");
+
+   /** . */
+   public static final Scope NAVIGATIONAL_STATE_SCOPE = new Scope("navigationalstate");
+   
+   /** . */
    protected static Logger log = Logger.getLogger(ControllerCommand.class);
 
-   /**
-    * The context of the command.
-    */
+   /** The context of the command. */
    protected CommandContext context;
 
+   /** Execute command when the end of the stack is reached. */
+   private static final InvocationHandler handler = new InvocationHandler()
+   {
+      public void invoke(Invocation invocation) throws Exception, InvocationException
+      {
+         ControllerCommand cmd = (ControllerCommand)invocation;
+         cmd.execute();
+      }
+   };
+
    protected ControllerCommand()
    {
+      setHandler(handler);
    }
 
    /**
@@ -52,8 +77,12 @@
     */
    public abstract CommandInfo getInfo();
 
-   public CommandContext getContext()
+   public InvocationContext getContext()
    {
+      if (context == null)
+      {
+         throw new IllegalStateException();
+      }
       return context;
    }
 
@@ -86,11 +115,6 @@
    {
    }
 
-   protected void dispatch() throws Exception, InvocationException
-   {  
-      execute();
-   }
-
    /**
     * Execute the command.
     */

Modified: trunk/core/src/main/org/jboss/portal/core/command/ExecutionContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ExecutionContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/ExecutionContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -73,9 +73,21 @@
       return serverInvocation.getResponse().encodeURL(serverURL, urlContext, format);
    }
 
+   void chain(ControllerCommand nextCommand) throws CommandException
+   {
+      if (nextCommand == null)
+      {
+         throw new IllegalArgumentException();
+      }
+
+      //
+      CommandContext nextCommandContext = new CommandContext(this, nextCommand);
+      execute(nextCommandContext);
+   }
+
    public void execute(ControllerCommand nextCommand) throws CommandException
    {
-      execute(new CommandContext(nextCommand));
+      execute(new CommandContext(this, nextCommand));
    }
 
    public void execute(CommandContext commandContext) throws CommandException
@@ -87,13 +99,11 @@
       try
       {
          nextDepth++;
-         commandContext.setExecutionContext(this);
          commandContext.execute();
       }
       finally
       {
          nextDepth--;
-         commandContext.setExecutionContext(null);
       }
 
       // Invoke forward command if necessary
@@ -115,14 +125,14 @@
          }
          else
          {
-            boolean currentAuthenticated = serverInvocation.getRequest().getContext().getURLContext().isAuthenticated();
+            boolean currentAuthenticated = serverInvocation.getServerContext().getURLContext().isAuthenticated();
             if (forwardURLContext != null && currentAuthenticated != forwardURLContext.isAuthenticated())
             {
                redirect = true;
             }
             else
             {
-               boolean currentSecure = serverInvocation.getRequest().getContext().getURLContext().getSecure();
+               boolean currentSecure = serverInvocation.getServerContext().getURLContext().getSecure();
                if (forwardURLContext != null && forwardURLContext.getSecure() && !currentSecure)
                {
                   redirect = true;
@@ -140,7 +150,7 @@
             }
             try
             {
-               serverInvocation.getResponse().getContext().getClientResponse().sendRedirect(url);
+               serverInvocation.getServerContext().getClientResponse().sendRedirect(url);
             }
             catch (IOException e)
             {
@@ -168,7 +178,7 @@
       {
          throw new IllegalArgumentException();
       }
-      this.currentForwardCommandContext = new CommandContext(forwardCommand);
+      this.currentForwardCommandContext = new CommandContext(this, forwardCommand);
       this.currentForwardURLContext = urlContext;
    }
 }

Modified: trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -26,9 +26,10 @@
 import org.jboss.portal.WindowState;
 import org.jboss.portal.core.command.portlet.CoreActionContext;
 import org.jboss.portal.core.output.SignOutResult;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletInvokerException;
 import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.NoSuchPortletException;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.portlet.result.ErrorResult;
 import org.jboss.portal.portlet.result.HTTPRedirectionResult;
@@ -38,7 +39,6 @@
 import org.jboss.portal.portlet.result.Result;
 import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.portlet.Parameters;
 
 import java.io.IOException;
 
@@ -108,10 +108,11 @@
       ServerInvocation sinv = context.getExecutionContext().getServerInvocation();
 
       //
-      CoreActionContext actionContext = new CoreActionContext(getContext().getExecutionContext(), sinv, portal, navigationalState, getWindowState(), getMode(), interactionState, formParameters, window);
+      CommandContext commandCtx = (CommandContext)getContext();
+      CoreActionContext actionCtx = new CoreActionContext(commandCtx, sinv, portal, navigationalState, getWindowState(), getMode(), interactionState, formParameters, window);
 
       //
-      PortletInvocation invocation = actionContext.createInvocation();
+      PortletInvocation invocation = actionCtx.createInvocation();
 
       //
       try
@@ -153,7 +154,7 @@
          {
             HTTPRedirectionResult redirectionResult = (HTTPRedirectionResult)result;
             String url = redirectionResult.getLocation();
-            sinv.getResponse().getContext().getClientResponse().sendRedirect(url);
+            sinv.getServerContext().getClientResponse().sendRedirect(url);
          }
          catch (IOException e)
          {
@@ -162,12 +163,12 @@
       }
       else if (result instanceof InsufficientTransportGuaranteeResult)
       {
-         boolean authenticated = context.getExecutionContext().getServerInvocation().getRequest().getContext().getURLContext().isAuthenticated();
+         boolean authenticated = context.getExecutionContext().getServerInvocation().getServerContext().getURLContext().isAuthenticated();
          context.forward(this, URLContext.newInstance(true, authenticated));
       }
       else if (result instanceof InsufficientPrivilegesResult)
       {
-         boolean authenticated = context.getExecutionContext().getServerInvocation().getRequest().getContext().getURLContext().isAuthenticated();
+         boolean authenticated = context.getExecutionContext().getServerInvocation().getServerContext().getURLContext().isAuthenticated();
          context.forward(this, URLContext.newInstance(true, authenticated));
       }
       else if (result instanceof SignOutResult)
@@ -185,7 +186,7 @@
          {
             // Redirect to the url we were targetting
             RenderPageCommand renderCmd = new RenderPageCommand(page.getId());
-            boolean secure = context.getExecutionContext().getServerInvocation().getRequest().getContext().getURLContext().getSecure();
+            boolean secure = context.getExecutionContext().getServerInvocation().getServerContext().getURLContext().getSecure();
             URLContext urlInfo = URLContext.newInstance(secure, false);
             context.forward(renderCmd, urlInfo);
          }
@@ -193,7 +194,7 @@
          {
             try
             {
-               sinv.getResponse().getContext().getClientResponse().sendRedirect(location);
+               sinv.getServerContext().getClientResponse().sendRedirect(location);
             }
             catch (IOException e)
             {

Modified: trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowMoveCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowMoveCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowMoveCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -68,7 +68,7 @@
       String url = context.getExecutionContext().encodeURL(rpc, null, null);
       try
       {
-         sinv.getResponse().getContext().getClientResponse().sendRedirect(url);
+         sinv.getServerContext().getClientResponse().sendRedirect(url);
       }
       catch (IOException e)
       {

Modified: trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -25,11 +25,12 @@
 import org.jboss.portal.WindowState;
 import org.jboss.portal.portlet.StateString;
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationContext;
 import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.strategy.StrategyException;
 import org.jboss.portal.theme.navigation.WindowNavigationalState;
+import org.jboss.portal.theme.LayoutService;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -74,22 +75,20 @@
 
    public void execute() throws InvocationException
    {
-      //
-      ServerInvocation sinv = context.getExecutionContext().getServerInvocation();
-      NavigationalStateContext navCtx = sinv.getRequest().getNavigationContext();
+      InvocationContext ctx = getContext();
 
       //
       if (navigationalState != null)
       {
-         navCtx.setNavigationalState(window.getInstanceRef(), navigationalState);
+         ctx.setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef(), navigationalState);
       }
 
       // Update the window nav state
-      WindowNavigationalState windowNavState = (WindowNavigationalState)navCtx.getNavigationalState(window.getInstanceRef() + "_window");
+      WindowNavigationalState windowNavState = (WindowNavigationalState)ctx.getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef() + "_window");
       if (windowNavState == null)
       {
          windowNavState = new WindowNavigationalState();
-         navCtx.setNavigationalState(window.getId() + "_window", windowNavState);
+         ctx.setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
       }
       if (mode != null)
       {
@@ -103,7 +102,9 @@
       // Udpate the page nav state
       try
       {
-         PageNavigationInterceptor.updatePageNavigationalState(context, sinv, portal, page, window, getMode(), getWindowState());
+         ServerInvocation sinv = ((CommandContext)getContext()).getExecutionContext().getServerInvocation();
+         LayoutService layoutService = ((CommandContext)getContext()).getExecutionContext().getController().getPageService().getLayoutService();
+         PageNavigationInterceptor.updatePageNavigationalState(layoutService, context, sinv, portal, page, window, getMode(), getWindowState());
       }
       catch (StrategyException e)
       {

Modified: trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,17 +21,18 @@
 */
 package org.jboss.portal.core.command;
 
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.common.util.Exceptions;
-import org.jboss.portal.core.command.portlet.CoreInvocationContext;
+import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
 import org.jboss.portal.core.model.instance.Instance;
 import org.jboss.portal.core.model.portal.Page;
 import org.jboss.portal.core.model.portal.PortalObject;
 import org.jboss.portal.core.model.portal.PortalObjectPermission;
 import org.jboss.portal.core.model.portal.Window;
 import org.jboss.portal.identity.User;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
 import org.jboss.portal.portlet.Properties;
 import org.jboss.portal.portlet.info.ModeInfo;
 import org.jboss.portal.portlet.info.WindowStateInfo;
@@ -46,7 +47,6 @@
 import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
 import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.theme.LayoutService;
 import org.jboss.portal.theme.PortalLayout;
@@ -185,7 +185,7 @@
     * @return a markup result containing the fragments rendered by the portlets in this command
     * @throws InvocationException
     */
-   public abstract MarkupResult renderFragments(ServerConfig cfg, NavigationalStateContext navCtx) throws CommandException;
+   public abstract MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws CommandException;
 
    /**
     * for security checks and navigational state, return the page of the requested MarkupContainer
@@ -290,12 +290,12 @@
    public final void execute() throws InvocationException
    {
       ServerInvocation sinv = context.getExecutionContext().getServerInvocation();
-      HttpServletRequest request = sinv.getRequest().getContext().getClientRequest();
+      HttpServletRequest request = sinv.getServerContext().getClientRequest();
       try
       {
          // Ensure that the page nav state is in place
-         NavigationalStateContext navCtx = sinv.getRequest().getNavigationContext();
-         PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getNavigationalState(page.getId());
+         AttributeResolver navCtx = sinv.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
+         PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
 
          if (pageNavState == null)
          {
@@ -308,7 +308,8 @@
 
          if (personalizable)
          {
-            User user = (User)getContext().getExecutionContext().getServerInvocation().getRequest().getUser();
+            CommandContext commandCtx = (CommandContext)getContext();
+            User user = (User)commandCtx.getExecutionContext().getServerInvocation().getRequest().getUser();
             if (user != null)
             {
                String themeId = user.getTheme();
@@ -357,7 +358,7 @@
          // name (specified as tag attribute); this is useful if no theme was defined for the portal or the page
          request.setAttribute(ThemeConstants.ATTR_THEMESERVER, pageService.getThemeService());
          // now delegate to the layout to do the rest (assemble the markup fragments into a response)
-         layout.assembleResponse(sinv.getRequest(), sinv.getResponse(), renderResult);
+         layout.assembleResponse(sinv, renderResult);
       }
       catch (InvocationException e)
       {
@@ -468,16 +469,16 @@
          //
          if (result instanceof InsufficientTransportGuaranteeResult)
          {
-            boolean authenticated = context.getExecutionContext().getServerInvocation().getRequest().getContext().getURLContext().isAuthenticated();
+            boolean authenticated = context.getExecutionContext().getServerInvocation().getServerContext().getURLContext().isAuthenticated();
             context.forward(this, URLContext.newInstance(true, authenticated));
             return new UnusableMarkupResult();
          }
 
          // Compute actions
-         CoreInvocationContext invCtx = (CoreInvocationContext)renderCmd.getInvocation().getContext();
+         CorePortletInvocationContext invCtx = (CorePortletInvocationContext)renderCmd.getInvocation().getContext();
 
          // Get window navigational state
-         WindowNavigationalState windowNavState = (WindowNavigationalState)this.context.getExecutionContext().getServerInvocation().getRequest().getNavigationContext().getNavigationalState(window.getId() + "_window");
+         WindowNavigationalState windowNavState = (WindowNavigationalState)this.context.getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window");
 
          //
          if (result instanceof FragmentResult)
@@ -675,7 +676,7 @@
     * @param currentWindowState
     * @param invCtx
     */
-   private static void addStateActions(Map actionMap, WindowState currentWindowState, List supportedWindowStates, CoreInvocationContext invCtx)
+   private static void addStateActions(Map actionMap, WindowState currentWindowState, List supportedWindowStates, CorePortletInvocationContext invCtx)
    {
       List windowStates = new ArrayList(supportedWindowStates.size());
       for (Iterator j = supportedWindowStates.iterator(); j.hasNext();)
@@ -697,7 +698,7 @@
     * @param currentMode
     * @param invCtx
     */
-   private static void addModeActions(Map actionMap, Mode currentMode, List supportedModes, CoreInvocationContext invCtx)
+   private static void addModeActions(Map actionMap, Mode currentMode, List supportedModes, CorePortletInvocationContext invCtx)
    {
       List modes = new ArrayList(supportedModes.size());
       for (Iterator j = supportedModes.iterator(); j.hasNext();)

Modified: trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -22,10 +22,10 @@
 package org.jboss.portal.core.command;
 
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.core.model.portal.PortalObject;
 import org.jboss.portal.core.model.portal.Window;
 import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.navigation.PageNavigationalState;
 import org.jboss.portal.theme.page.ModifiablePageResult;
 import org.jboss.portal.theme.page.UnusableMarkupResult;
@@ -56,9 +56,9 @@
     * @return a modifiable page result containing the markup fragments from the individual portlets on this page
     * @throws InvocationException
     */
-   public MarkupResult renderFragments(ServerConfig cfg, NavigationalStateContext navCtx) throws CommandException
+   public MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws CommandException
    {
-      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getNavigationalState(getPage().getId());
+      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
       ModifiablePageResult pageResult = new ModifiablePageResult(navCtx, getPage().getName(), getPage().getDeclaredPropertyMap(), getPage().getPortal().getDeclaredPropertyMap());
 
       // all windows on the page

Modified: trunk/core/src/main/org/jboss/portal/core/command/RenderRegionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderRegionCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/RenderRegionCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -22,10 +22,10 @@
 package org.jboss.portal.core.command;
 
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.core.model.portal.PortalObject;
 import org.jboss.portal.core.model.portal.Window;
 import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.navigation.PageNavigationalState;
 import org.jboss.portal.theme.page.ModifiableRegionResult;
 import org.jboss.portal.theme.page.Region;
@@ -58,9 +58,9 @@
     * @return a modifiable region result containing the markup fragments from the individual portlets on this page
     * @throws InvocationException
     */
-   public MarkupResult renderFragments(ServerConfig cfg, NavigationalStateContext navCtx) throws CommandException
+   public MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws CommandException
    {
-      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getNavigationalState(getPage().getId());
+      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
       Region region = (Region)getMarkupContainer();
       ModifiableRegionResult regionResult = new ModifiableRegionResult(navCtx, getPage().getName(), region, getPage().getDeclaredPropertyMap(), getPage().getPortal().getDeclaredPropertyMap());
 

Modified: trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -80,14 +80,14 @@
       ServerInvocation sinv = context.getExecutionContext().getServerInvocation();
 
       //
-      StateString ns = (StateString)sinv.getRequest().getNavigationContext().getNavigationalState(window.getInstanceRef());
+      StateString ns = (StateString)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef());
 
       //
-      WindowNavigationalState windowNavState = (WindowNavigationalState)sinv.getRequest().getNavigationContext().getNavigationalState(windowRef + "_window");
+      WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, windowRef + "_window");
       if (windowNavState == null)
       {
          windowNavState = new WindowNavigationalState();
-         sinv.getRequest().getNavigationContext().setNavigationalState(window.getId() + "_window", windowNavState);
+         setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
       }
 
       // Get the mode
@@ -97,7 +97,7 @@
       WindowState windowState = windowNavState.getWindowState();
 
       //
-      CoreRenderContext renderContext = new CoreRenderContext(getContext().getExecutionContext(), sinv, portal, ns, mode, windowState, window);
+      CoreRenderContext renderContext = new CoreRenderContext((CommandContext)getContext(), sinv, portal, ns, mode, windowState, window);
 
       //
       invocation = (RenderInvocation)renderContext.createInvocation();

Modified: trunk/core/src/main/org/jboss/portal/core/command/RenderWindowContextCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderWindowContextCommand.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/RenderWindowContextCommand.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -22,10 +22,10 @@
 package org.jboss.portal.core.command;
 
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.core.model.portal.PortalObject;
 import org.jboss.portal.core.model.portal.Window;
 import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.navigation.PageNavigationalState;
 import org.jboss.portal.theme.page.ModifiableWindowResult;
 import org.jboss.portal.theme.page.UnusableMarkupResult;
@@ -56,9 +56,9 @@
     * @return a modifiable window result containing the markup fragment from the portlet assigned to this window
     * @throws InvocationException
     */
-   public MarkupResult renderFragments(ServerConfig cfg, NavigationalStateContext navCtx) throws CommandException
+   public MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws CommandException
    {
-      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getNavigationalState(getPage().getId());
+      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
       WindowContext windowFragment = (WindowContext)getMarkupContainer();
 
       // all windows on the page

Modified: trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreActionContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreActionContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreActionContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,17 +21,17 @@
 */
 package org.jboss.portal.core.command.portlet;
 
-import org.jboss.portal.core.command.ExecutionContext;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.command.CommandContext;
 import org.jboss.portal.core.model.portal.Portal;
 import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.portlet.spi.ActionContext;
+import org.jboss.portal.portlet.Parameters;
 import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.spi.ActionContext;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.BufferedReader;
@@ -42,7 +42,7 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class CoreActionContext extends CoreInvocationContext implements ActionContext
+public class CoreActionContext extends CorePortletInvocationContext implements ActionContext
 {
 
    private HttpServletRequest req;
@@ -50,7 +50,7 @@
    private Parameters form;
 
    public CoreActionContext(
-      ExecutionContext executionContext,
+      CommandContext commandContext,
       ServerInvocation invocation,
       Portal portal,
       StateString navigationalState,
@@ -60,8 +60,8 @@
       Parameters form,
       Window window)
    {
-      super(executionContext, invocation, portal, navigationalState, mode, windowState, window);
-      this.req = invocation.getRequest().getContext().getClientRequest();
+      super(commandContext, invocation, portal, navigationalState, mode, windowState, window);
+      this.req = invocation.getServerContext().getClientRequest();
       this.interactionState = interactionState;
       this.form = form;
    }

Deleted: trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreInvocationContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,214 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.core.command.portlet;
-
-import org.jboss.portal.portlet.spi.InvocationContext;
-import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.portlet.spi.RequestContext;
-import org.jboss.portal.portlet.spi.SecurityContext;
-import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
-import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
-import org.jboss.portal.portlet.impl.spi.AbstractInvocationContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.core.command.ExecutionContext;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.PortalContextImpl;
-import org.jboss.portal.core.model.portal.WindowContextImpl;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerResponse;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.Mode;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.WindowState;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class CoreInvocationContext extends AbstractInvocationContext implements InvocationContext
-{
-
-   /** . */
-   protected ExecutionContext executionContext;
-
-   /** . */
-   protected ServerRequest serverRequest;
-
-   /** . */
-   protected ServerResponse serverResponse;
-
-   /** . */
-   private Mode mode;
-
-   /** . */
-   private WindowState windowState;
-
-   /** . */
-   private Window window;
-
-   /** . */
-   protected StateString navigationalState;
-
-   /** . */
-   protected PortalContext portalContext;
-
-   /** . */
-   protected RequestContext requestContext;
-
-   /** . */
-   protected SecurityContext securityContext;
-
-   /** . */
-   protected UserContext userContext;
-
-   /** . */
-   protected WindowContext windowContext;
-
-   public CoreInvocationContext(
-      ExecutionContext executionContext,
-      ServerInvocation invocation,
-      Portal portal,
-      StateString navigationalState,
-      Mode mode,
-      WindowState windowState,
-      Window window)
-   {
-      this.executionContext = executionContext;
-      this.serverRequest = invocation.getRequest();
-      this.serverResponse = invocation.getResponse();
-      this.window = window;
-      this.mode = mode;
-      this.windowState = windowState;
-      this.navigationalState = navigationalState;
-
-      this.requestContext = new AbstractRequestContext(serverRequest.getContext().getClientRequest(), serverResponse.getContext().getClientResponse());
-      this.securityContext = new AbstractSecurityContext(serverRequest.getContext().getClientRequest());
-      this.userContext = new CoreUserContext(serverRequest);
-      this.portalContext = new PortalContextImpl(portal);
-      this.windowContext = new WindowContextImpl(window);
-   }
-
-   public HttpServletResponse getClientResponse()
-   {
-      return serverResponse.getContext().getClientResponse();
-   }
-
-   public HttpServletRequest getClientRequest()
-   {
-      return serverRequest.getContext().getClientRequest();
-   }
-
-   public Mode getMode()
-   {
-      return mode;
-   }
-
-   public WindowState getWindowState()
-   {
-      return windowState;
-   }
-
-   public StateString getNavigationalState()
-   {
-      return navigationalState;
-   }
-
-   public HTTPStreamInfo getStreamInfo()
-   {
-      return serverResponse.getStreamInfo();
-   }
-
-   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
-   {
-      ControllerCommand cmd = null;
-      if (portletURL instanceof ActionURL)
-      {
-         ActionURL actionURL = (ActionURL)portletURL;
-         cmd = new InvokeWindowActionCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), actionURL.getNavigationalState(), actionURL.getInteractionState(), null);
-      }
-      else
-      {
-         cmd = new InvokeWindowRenderCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), ((RenderURL)portletURL).getNavigationalState());
-      }
-
-      //
-      boolean secure = serverRequest.getContext().getURLContext().getSecure();
-      if (wantSecure != null)
-      {
-         secure = wantSecure.booleanValue();
-      }
-
-      //
-      boolean authenticated = serverRequest.getContext().getURLContext().isAuthenticated();
-      if (wantAuthenticated != null)
-      {
-         authenticated = wantAuthenticated.booleanValue();
-      }
-
-      URLContext info = URLContext.newInstance(secure, authenticated);
-      return executionContext.encodeURL(cmd, info, URLFormat.newInstance(relative, true));
-   }
-
-  public PortletInvocation createInvocation()
-   {
-      PortletInvocation invocation = newInvocation();
-
-      // Contextualize
-      invocation.setSecurityContext(securityContext);
-      invocation.setRequestContext(requestContext);
-      invocation.setPortalContext(portalContext);
-      invocation.setWindowContext(windowContext);
-      invocation.setUserContext(userContext);
-      return invocation;
-   }
-
-   protected abstract PortletInvocation newInvocation();
-
-   public String encodeURL(ControllerCommand cmd, URLContext urlContext, boolean relative)
-   {
-      return executionContext.encodeURL(cmd, urlContext, URLFormat.newInstance(relative, true));
-   }
-
-   public String createUpdateNavigationalStateURL(Mode mode, WindowState windowState)
-   {
-      InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState);
-      boolean secure = serverRequest.getContext().getURLContext().getSecure();
-      boolean authenticated = serverRequest.getContext().getURLContext().isAuthenticated();
-      URLContext urlContext = URLContext.newInstance(secure, authenticated);
-      return executionContext.encodeURL(cmd, urlContext, URLFormat.newInstance(true, true));
-   }
-}

Added: trunk/core/src/main/org/jboss/portal/core/command/portlet/CorePortletInvocationContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CorePortletInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/portlet/CorePortletInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,212 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.core.command.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.command.CommandContext;
+import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalContextImpl;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.WindowContextImpl;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
+import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5064 $
+ */
+public abstract class CorePortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext
+{
+
+   /** . */
+   protected CommandContext commandContext;
+
+   /** . */
+   protected ServerInvocation invocation;
+
+   /** . */
+   private Mode mode;
+
+   /** . */
+   private WindowState windowState;
+
+   /** . */
+   private Window window;
+
+   /** . */
+   protected StateString navigationalState;
+
+   /** . */
+   protected PortalContext portalContext;
+
+   /** . */
+   protected RequestContext requestContext;
+
+   /** . */
+   protected SecurityContext securityContext;
+
+   /** . */
+   protected UserContext userContext;
+
+   /** . */
+   protected WindowContext windowContext;
+
+   public CorePortletInvocationContext(
+      CommandContext commandContext,
+      ServerInvocation invocation,
+      Portal portal,
+      StateString navigationalState,
+      Mode mode,
+      WindowState windowState,
+      Window window)
+   {
+      this.commandContext = commandContext;
+      this.invocation = invocation;
+      this.window = window;
+      this.mode = mode;
+      this.windowState = windowState;
+      this.navigationalState = navigationalState;
+
+      this.requestContext = new AbstractRequestContext(invocation.getServerContext().getClientRequest(), invocation.getServerContext().getClientResponse());
+      this.securityContext = new AbstractSecurityContext(invocation.getServerContext().getClientRequest());
+      this.userContext = new CoreUserContext(invocation);
+      this.portalContext = new PortalContextImpl(portal);
+      this.windowContext = new WindowContextImpl(window);
+
+      //
+      addResolver(PortletInvocation.REQUEST_SCOPE, commandContext);
+      addResolver(PortletInvocation.PRINCIPAL_SCOPE, commandContext);
+   }
+
+   public HttpServletResponse getClientResponse()
+   {
+      return invocation.getServerContext().getClientResponse();
+   }
+
+   public HttpServletRequest getClientRequest()
+   {
+      return invocation.getServerContext().getClientRequest();
+   }
+
+   public Mode getMode()
+   {
+      return mode;
+   }
+
+   public WindowState getWindowState()
+   {
+      return windowState;
+   }
+
+   public StateString getNavigationalState()
+   {
+      return navigationalState;
+   }
+
+   public HTTPStreamInfo getStreamInfo()
+   {
+      return invocation.getResponse().getStreamInfo();
+   }
+
+   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+   {
+      ControllerCommand cmd = null;
+      if (portletURL instanceof ActionURL)
+      {
+         ActionURL actionURL = (ActionURL)portletURL;
+         cmd = new InvokeWindowActionCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), actionURL.getNavigationalState(), actionURL.getInteractionState(), null);
+      }
+      else
+      {
+         cmd = new InvokeWindowRenderCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), ((RenderURL)portletURL).getNavigationalState());
+      }
+
+      //
+      boolean secure = invocation.getServerContext().getURLContext().getSecure();
+      if (wantSecure != null)
+      {
+         secure = wantSecure.booleanValue();
+      }
+
+      //
+      boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
+      if (wantAuthenticated != null)
+      {
+         authenticated = wantAuthenticated.booleanValue();
+      }
+
+      URLContext info = URLContext.newInstance(secure, authenticated);
+      return commandContext.getExecutionContext().encodeURL(cmd, info, URLFormat.newInstance(relative, true));
+   }
+
+  public PortletInvocation createInvocation()
+   {
+      PortletInvocation invocation = newInvocation();
+
+      // Contextualize
+      invocation.setSecurityContext(securityContext);
+      invocation.setRequestContext(requestContext);
+      invocation.setPortalContext(portalContext);
+      invocation.setWindowContext(windowContext);
+      invocation.setUserContext(userContext);
+      return invocation;
+   }
+
+   protected abstract PortletInvocation newInvocation();
+
+   public String encodeURL(ControllerCommand cmd, URLContext urlContext, boolean relative)
+   {
+      return commandContext.getExecutionContext().encodeURL(cmd, urlContext, URLFormat.newInstance(relative, true));
+   }
+
+   public String createUpdateNavigationalStateURL(Mode mode, WindowState windowState)
+   {
+      InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState);
+      boolean secure = invocation.getServerContext().getURLContext().getSecure();
+      boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
+      URLContext urlContext = URLContext.newInstance(secure, authenticated);
+      return commandContext.getExecutionContext().encodeURL(cmd, urlContext, URLFormat.newInstance(true, true));
+   }
+}


Property changes on: trunk/core/src/main/org/jboss/portal/core/command/portlet/CorePortletInvocationContext.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreRenderContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreRenderContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreRenderContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,7 +21,7 @@
 */
 package org.jboss.portal.core.command.portlet;
 
-import org.jboss.portal.core.command.ExecutionContext;
+import org.jboss.portal.core.command.CommandContext;
 import org.jboss.portal.core.model.portal.Portal;
 import org.jboss.portal.core.model.portal.Window;
 import org.jboss.portal.portlet.spi.RenderContext;
@@ -36,11 +36,11 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class CoreRenderContext extends CoreInvocationContext implements RenderContext
+public class CoreRenderContext extends CorePortletInvocationContext implements RenderContext
 {
 
    public CoreRenderContext(
-      ExecutionContext executionContext,
+      CommandContext commandContext,
       ServerInvocation invocation,
       Portal portal,
       StateString navigationalState,
@@ -48,7 +48,7 @@
       WindowState windowState,
       Window window)
    {
-      super(executionContext, invocation, portal, navigationalState, mode, windowState, window);
+      super(commandContext, invocation, portal, navigationalState, mode, windowState, window);
    }
 
    protected PortletInvocation newInvocation()

Modified: trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreUserContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreUserContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreUserContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -24,7 +24,7 @@
 import org.jboss.portal.common.util.Tools;
 import org.jboss.portal.identity.User;
 import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.server.ServerInvocation;
 
 import java.util.List;
 import java.util.Locale;
@@ -38,17 +38,17 @@
 {
 
    /** . */
-   private final ServerRequest serverReq;
+   private final ServerInvocation invocation;
 
-   public CoreUserContext(ServerRequest serverReq)
+   public CoreUserContext(ServerInvocation invocation)
    {
-      this.serverReq = serverReq;
+      this.invocation = invocation;
    }
 
    /** This implementation returns the remote user value from the underlying http request. */
    public String getId()
    {
-      return serverReq.getContext().getClientRequest().getRemoteUser();
+      return invocation.getServerContext().getClientRequest().getRemoteUser();
    }
 
    public Map getInformations()
@@ -66,16 +66,16 @@
 
    public User getUser()
    {
-      return (User)serverReq.getUser();
+      return (User)invocation.getRequest().getUser();
    }
 
    public Locale getLocale()
    {
-      return serverReq.getLocale();
+      return invocation.getRequest().getLocale();
    }
 
    public List getLocales()
    {
-      return Tools.toList(serverReq.getLocales());
+      return Tools.toList(invocation.getRequest().getLocales());
    }
 }

Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -239,7 +239,8 @@
       AccessMode accessMode = AccessMode.READ_ONLY;
       if (userId != null)
       {
-         if (Mode.EDIT_DEFAULTS.equals(invocation.getContext().getMode()))
+         org.jboss.portal.portlet.spi.PortletInvocationContext ctxabc = (org.jboss.portal.portlet.spi.PortletInvocationContext)invocation.getContext();
+         if (Mode.EDIT_DEFAULTS.equals(ctxabc.getMode()))
          {
             // Implement it by using the shared portlet id, but a security check should be made on using this
             // mode first
@@ -273,8 +274,8 @@
 
       try
       {
-         invocation.setAttribute(PortletInvocation.INSTANCE_ID_ATTRIBUTE, instanceId);
-         invocation.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, portletId);
+         invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.INSTANCE_ID_ATTRIBUTE, instanceId);
+         invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, portletId);
          invocation.setInstanceContext(instanceContext);
 
          // Perform invocation
@@ -283,8 +284,8 @@
       finally
       {
          // Reset state before invocation
-         invocation.removeAttribute(PortletInvocation.INSTANCE_ID_ATTRIBUTE);
-         invocation.removeAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE);
+         invocation.removeAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.INSTANCE_ID_ATTRIBUTE);
+         invocation.removeAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE);
          invocation.setInstanceContext(null);
 
          // Create user instance if a clone operation occured

Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceSecurityInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceSecurityInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceSecurityInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -66,7 +66,7 @@
    {
       try
       {
-         String instanceid = (String)invocation.getAttribute(PortletInvocation.INSTANCE_ID_ATTRIBUTE);
+         String instanceid = (String)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.INSTANCE_ID_ATTRIBUTE);
          PortalAuthorizationManager pam = pamf.getManager();
          InstancePermission perm = new InstancePermission(instanceid, InstancePermission.VIEW_MASK);
          boolean authorized = pam.checkPermission(perm);

Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -121,14 +121,14 @@
 
          //
          PortletRequestDecoder decoder = new PortletRequestDecoder();
-         decoder.decode(req.getContext().getParameterMap());
+         decoder.decode(invocation.getServerContext().getParameterMap());
 
          // Get the window navigational state
-         WindowNavigationalState windowNavState = (WindowNavigationalState)invocation.getRequest().getNavigationContext().getNavigationalState(window.getId() + "_window");
+         WindowNavigationalState windowNavState = (WindowNavigationalState)invocation.getAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window");
          if (windowNavState == null)
          {
             windowNavState = new WindowNavigationalState();
-            invocation.getRequest().getNavigationContext().setNavigationalState(window.getId() + "_window", windowNavState);
+            invocation.setAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
          }
 
          //

Modified: trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -28,9 +28,8 @@
 import org.jboss.portal.cms.model.File;
 import org.jboss.portal.cms.util.FileUtil;
 import org.jboss.portal.core.cms.command.StreamContentCommand;
-import org.jboss.portal.core.command.portlet.CoreInvocationContext;
+import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.server.request.URLContext;
 import org.jboss.portlet.JBossRenderResponse;
 
 import javax.portlet.GenericPortlet;
@@ -267,7 +266,7 @@
    {
       StreamContentCommand cmd = new StreamContentCommand(path);
       PortletInvocation invocation = ((JBossRenderResponse) resp).getInvocation();
-      CoreInvocationContext ccrc = (CoreInvocationContext) invocation.getContext();
+      CorePortletInvocationContext ccrc = (CorePortletInvocationContext) invocation.getContext();
       return ccrc.encodeURL(cmd, null, true);
    }
 

Modified: trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -37,7 +37,7 @@
 import org.jboss.portal.cms.util.FileUtil;
 import org.jboss.portal.cms.util.NodeUtil;
 import org.jboss.portal.core.cms.command.StreamContentCommand;
-import org.jboss.portal.core.command.portlet.CoreInvocationContext;
+import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.theme.PortalTheme;
@@ -857,7 +857,7 @@
    {
       StreamContentCommand cmd = new StreamContentCommand(path);
       PortletInvocation invocation = ((JBossRenderResponse)resp).getInvocation();
-      CoreInvocationContext ccrc = (CoreInvocationContext)invocation.getContext();
+      CorePortletInvocationContext ccrc = (CorePortletInvocationContext)invocation.getContext();
       String url = ccrc.encodeURL(cmd, URLContext.newInstance(false, false), true);
       return url;
    }

Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -275,7 +275,7 @@
          }
          public void invoke(PortletInvocation invocation)
          {
-            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
             props.update(new PropertyChange[]{PropertyChange.newUpdate("abc", new StringValue("def"))});
          }
       });
@@ -341,7 +341,7 @@
          }
          public void invoke(PortletInvocation invocation)
          {
-            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
             props.update(new PropertyChange[]{PropertyChange.newUpdate("abc", new StringValue("def"))});
          }
       });
@@ -385,7 +385,7 @@
          }
          public void invoke(PortletInvocation invocation)
          {
-            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
             props.update(new PropertyChange[]{PropertyChange.newUpdate("abc", new StringValue("def"))});
             throw new RuntimeException("custom_message");
          }
@@ -436,7 +436,7 @@
          }
          public void invoke(PortletInvocation invocation)
          {
-            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
             props.update(new PropertyChange[]{PropertyChange.newUpdate("abc", new StringValue("def"))});
          }
       });

Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -22,8 +22,13 @@
 package org.jboss.portal.test.core.model.instance;
 
 import org.jboss.portal.portlet.support.spi.ActionContextSupport;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.Mode;
+import org.jboss.portal.common.invocation.Scope;
 
+import java.util.Map;
+import java.util.HashMap;
+
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
@@ -32,15 +37,71 @@
 {
 
    /** . */
+   private Map requestAttrs;
+
+   /** . */
    private final Mode mode;
 
    public SimpleActionContext(Mode mode)
    {
       this.mode = mode;
+      this.requestAttrs = new HashMap();
    }
 
    public Mode getMode()
    {
       return mode;
    }
+
+   public void setAttribute(Scope scope, String name, Object value)
+   {
+      if (scope == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      if (name == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      if (PortletInvocation.REQUEST_SCOPE.equals(scope))
+      {
+         if (value != null)
+         {
+            requestAttrs.put(name, value);
+         }
+         else
+         {
+            requestAttrs.remove(name);
+         }
+      }
+      else
+      {
+         throw new IllegalArgumentException();
+      }
+   }
+
+   public Object getAttribute(Scope scope, String name)
+   {
+      if (scope == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      if (name == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      if (PortletInvocation.REQUEST_SCOPE.equals(scope))
+      {
+         return requestAttrs.get(name);
+      }
+      else
+      {
+         throw new IllegalArgumentException();
+      }
+   }
+
+   public void removeAttribute(Scope attrScope, String attrName)
+   {
+      setAttribute(attrScope, attrName, null);
+   }
 }

Modified: trunk/core/src/main/org/jboss/portal/test/core/state/StatefulPortletInvokerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/StatefulPortletInvokerTestCase.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/StatefulPortletInvokerTestCase.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -161,7 +161,7 @@
          }
          public void invoke(PortletInvocation invocation)
          {
-            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
             props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
          }
       });
@@ -174,7 +174,7 @@
          }
          public void invoke(PortletInvocation invocation)
          {
-            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
             props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
          }
       });
@@ -189,7 +189,7 @@
          {
             try
             {
-               AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+               AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
                props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
                fail("Was expecting an IllegalStateException");
             }
@@ -207,7 +207,7 @@
          }
          public void invoke(PortletInvocation invocation)
          {
-            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+            AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
             props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
             throw new RuntimeException("custom_message");
          }
@@ -394,7 +394,7 @@
    {
       TransactionAssert.beginTransaction();
       PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloningPortlet");
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloningPortlet");
       action.setUserContext(new SimpleUserContext("julien"));
       SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
       action.setInstanceContext(instanceContext);
@@ -420,7 +420,7 @@
    {
       TransactionAssert.beginTransaction();
       PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloneFailedCloningPortlet");
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloneFailedCloningPortlet");
       action.setUserContext(new SimpleUserContext("julien"));
       SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_WRITE);
       action.setInstanceContext(instanceContext);
@@ -437,7 +437,7 @@
    {
       TransactionAssert.beginTransaction();
       PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloneFailedCloningPortlet");
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloneFailedCloningPortlet");
       action.setUserContext(new SimpleUserContext("julien"));
       SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_ONLY);
       action.setInstanceContext(instanceContext);
@@ -467,7 +467,7 @@
       //
       TransactionAssert.beginTransaction();
       PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, cloningPortletId);
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, cloningPortletId);
       action.setUserContext(new SimpleUserContext("julien"));
       SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
       action.setInstanceContext(instanceContext);
@@ -498,7 +498,7 @@
       //
       TransactionAssert.beginTransaction();
       PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, cloningPortletId);
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, cloningPortletId);
       action.setUserContext(new SimpleUserContext("julien"));
       SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_WRITE);
       action.setInstanceContext(instanceContext);
@@ -528,7 +528,7 @@
       //
       TransactionAssert.beginTransaction();
       PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, cloneFailedCloningPortletId);
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, cloneFailedCloningPortletId);
       action.setUserContext(new SimpleUserContext("julien"));
       SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_ONLY);
       action.setInstanceContext(instanceContext);
@@ -545,7 +545,7 @@
    {
       TransactionAssert.beginTransaction();
       PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloningPortletThrowingRuntimeException");
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, "CloningPortletThrowingRuntimeException");
       action.setUserContext(new SimpleUserContext("julien"));
       SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
       action.setInstanceContext(instanceContext);

Modified: trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -41,8 +41,8 @@
       <depends>portal:service=CMSTreeCacheService</depends>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Cms"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Cms"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -66,7 +66,7 @@
       <depends>portal:service=Hibernate,type=CMS</depends>
       <!--
          @portal.single.xml.close@
-         <depends optional-attribute-name="CmsStack" proxy-type="attribute">portal:service=InterceptorStack,type=Cms</depends>
+         <depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Cms</depends>
       @portal.single.xml.open@
       -->
       <attribute name="DoChecking">true</attribute>

Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -94,15 +94,16 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.aspects.server.NavigationInterceptor"
-      name="portal:service=Interceptor,type=Server,name=Navigation"
+      code="org.jboss.portal.server.aspects.server.ControllerInterceptor"
+      name="portal:service=Interceptor,type=Server,name=Controller"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
+      <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Server"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Server"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -112,7 +113,7 @@
          <depends-list-element>portal:service=Interceptor,type=Server,name=User</depends-list-element>
          <depends-list-element>portal:service=Interceptor,type=Server,name=Locale</depends-list-element>
          <depends-list-element>portal:service=Interceptor,type=Server,name=ContentType</depends-list-element>
-         <depends-list-element>portal:service=Interceptor,type=Server,name=Navigation</depends-list-element>
+         <depends-list-element>portal:service=Interceptor,type=Server,name=Controller</depends-list-element>
       </depends-list>
    </mbean>
 
@@ -147,8 +148,8 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Command"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Command"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -160,7 +161,7 @@
       </depends-list>
    </mbean>
 
-   <!-- Consumer stack -->
+   <!-- Instance stack -->
    <mbean
       code="org.jboss.portal.core.model.instance.InstanceSecurityInterceptor"
       name="portal:service=Interceptor,type=Portlet,name=InstanceSecurity"
@@ -184,8 +185,8 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Instance"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Instance"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -275,8 +276,8 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Producer"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Producer"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -605,8 +606,8 @@
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
       <depends
-         optional-attribute-name="Stack"
-         proxy-type="attribute">portal:service=InterceptorStack,type=Producer</depends>
+         optional-attribute-name="StackFactory"
+         proxy-type="attribute">portal:service=InterceptorStackFactory,type=Producer</depends>
       <depends
          optional-attribute-name="Registry"
          proxy-type="attribute">portal:service=WebAppRegistry</depends>
@@ -654,8 +655,8 @@
          optional-attribute-name="Producer"
          proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
       <depends
-         optional-attribute-name="Stack"
-         proxy-type="attribute">portal:service=InterceptorStack,type=Instance</depends>
+         optional-attribute-name="StackFactory"
+         proxy-type="attribute">portal:service=InterceptorStackFactory,type=Instance</depends>
    </mbean>
 
 
@@ -676,8 +677,8 @@
          optional-attribute-name="URLFactory"
          proxy-type="attribute">portal:urlFactory=Delegating</depends>
       <depends
-         optional-attribute-name="CommandStack"
-         proxy-type="attribute">portal:service=InterceptorStack,type=Command</depends>
+         optional-attribute-name="StackFactory"
+         proxy-type="attribute">portal:service=InterceptorStackFactory,type=Command</depends>
       <depends
          optional-attribute-name="PortalObjectContainer"
          proxy-type="attribute">portal:container=PortalObject</depends>

Modified: trunk/federation/src/main/org/jboss/portal/federation/impl/FederatedPortletInvokerService.java
===================================================================
--- trunk/federation/src/main/org/jboss/portal/federation/impl/FederatedPortletInvokerService.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/federation/src/main/org/jboss/portal/federation/impl/FederatedPortletInvokerService.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -133,18 +133,18 @@
 
    public void invoke(PortletInvocation invocation) throws InvocationException, PortletInvokerException
    {
-      String compoundPortletId = (String)invocation.getAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE);
+      String compoundPortletId = (String)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE);
       String portletId = getPortletIdFrom(compoundPortletId);
       InstanceContext instanceContext = invocation.getInstanceContext();
       try
       {
-         invocation.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, portletId);
+         invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, portletId);
          invocation.setInstanceContext(new FederatedInstanceContext(instanceContext));
          portletInvoker.invoke(invocation);
       }
       finally
       {
-         invocation.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, compoundPortletId);
+         invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, compoundPortletId);
          invocation.setInstanceContext(instanceContext);
       }
    }

Modified: trunk/federation/src/main/org/jboss/portal/federation/impl/FederatingPortletInvokerService.java
===================================================================
--- trunk/federation/src/main/org/jboss/portal/federation/impl/FederatingPortletInvokerService.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/federation/src/main/org/jboss/portal/federation/impl/FederatingPortletInvokerService.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -153,7 +153,7 @@
 
    public void invoke(PortletInvocation invocation) throws PortletInvokerException
    {
-      String compoundPortletId = (String)invocation.getAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE);
+      String compoundPortletId = (String)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE);
       FederatedPortletInvoker federated = getFederatedPortletInvokerFor(compoundPortletId);
       federated.invoke(invocation);
    }

Modified: trunk/portlet/build.xml
===================================================================
--- trunk/portlet/build.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/build.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -536,9 +536,10 @@
             <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.info.InfoTestSuite"/>-->
             <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.deployment.UnmarshallerTestCase"/>-->
             <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.PortletRequestDecoderTestCase"/>-->
-            <test todir="${test.reports}" name="org.jboss.portal.test.portlet.state.StatefulPortletInvokerTestCase"/>
+            <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.state.StatefulPortletInvokerTestCase"/>-->
             <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.portletrequests.PortletRequestTestSuite"/>-->
             <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.dispatcher.DispatcherTestSuite"/>-->
+            <test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.portletrequests.PortletRequestTestSuite"/>
          </x-test>
          <x-classpath>
             <path refid="oswego.concurrent.classpath"/>

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,19 +21,20 @@
 */
 package org.jboss.portal.portlet.aspects.portlet;
 
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
 import org.jboss.portal.portlet.invocation.PortletInterceptor;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
 import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.result.FragmentResult;
 import org.jboss.portal.portlet.result.Result;
-import org.jboss.portal.portlet.result.FragmentResult;
+import org.jboss.portal.portlet.result.cache.StrongTimedContent;
 import org.jboss.portal.portlet.result.cache.TimedContent;
-import org.jboss.portal.portlet.result.cache.StrongTimedContent;
-import org.jboss.portal.portlet.spi.InvocationContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.server.ServerInvocation;
 
 import java.io.Serializable;
 
@@ -45,21 +46,21 @@
 {
    protected void invoke(PortletInvocation invocation) throws Exception, InvocationException
    {
-      InvocationContext invocationCtx = invocation.getContext();
+      PortletInvocationContext invocationCtx = invocation.getPortletContext();
       String scopeKey = "cached_markup." + invocation.getWindowContext().getId();
 
       //
       if (invocation instanceof ActionInvocation)
       {
          //
-         invocationCtx.setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, null);
+         invocationCtx.setAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey, null);
 
          // Invoke
         invocation.invokeNext();
       }
       else if (invocation instanceof RenderInvocation)
       {
-         CacheEntry cachedEntry = (CacheEntry)invocationCtx.getAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey);
+         CacheEntry cachedEntry = (CacheEntry)invocationCtx.getAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey);
 
          //
          FragmentResult fragment = null;
@@ -82,7 +83,7 @@
             // Remove the cached fragment
             if (fragment == null)
             {
-               invocationCtx.setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, null);
+               invocationCtx.setAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey, null);
             }
          }
 
@@ -116,7 +117,7 @@
                {
                   CacheKey cacheKey = new CacheKey(invocationCtx.getNavigationalState(), invocationCtx.getWindowState(), invocationCtx.getMode());
                   CacheEntry cacheEntry = new CacheEntry(renderResult, cacheKey, expirationTimeMillis);
-                  invocationCtx.setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, cacheEntry);
+                  invocationCtx.setAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey, cacheEntry);
                }
             }
          }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -44,7 +44,7 @@
 
    protected void invoke(PortletInvocation invocation) throws Exception, InvocationException
    {
-      if (invocation.getContext().getMode() == null)
+      if ((invocation.getPortletContext()).getMode() == null)
       {
          throw new InvocationException("No mode has been provided");
       }
@@ -65,7 +65,7 @@
    protected Set getModes(PortletInvocation invocation)
    {
       // Get content type
-      HTTPStreamInfo si = invocation.getContext().getStreamInfo();
+      HTTPStreamInfo si = invocation.getPortletContext().getStreamInfo();
       String contentType = si.getContentType().toString();
 
       // Get the modes for this content type

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,11 +21,12 @@
 */
 package org.jboss.portal.portlet.aspects.portlet;
 
+import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.portlet.invocation.PortletInterceptor;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.InvocationContext;
 import org.jboss.portal.portlet.session.SubSession;
-import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.server.ServerInvocation;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -47,7 +48,7 @@
       // Should be left up to the caller whenever it is possible
       try
       {
-         InvocationContext ctx = invocation.getContext();
+         PortletInvocationContext ctx = invocation.getPortletContext();
          Method getClientRequestMethod = ctx.getClass().getMethod("getClientRequest", new Class[0]);
          req = (HttpServletRequest)getClientRequestMethod.invoke(ctx, new Object[0]);
       }
@@ -78,7 +79,7 @@
             // Set the sub session for the portlet synchronization
             if (ss != null && ss.isActivated())
             {
-               invocation.setAttribute("subsession", ss);
+               invocation.setAttribute(ServerInvocation.REQUEST_SCOPE, "subsession", ss);
             }
 
             //
@@ -86,13 +87,13 @@
          }
          finally
          {
-            List modifications = (List)invocation.getAttribute("subsession");
+            List modifications = (List)invocation.getAttribute(ServerInvocation.REQUEST_SCOPE, "subsession");
 
             // If we have any modifications propagate them
             if (modifications != null)
             {
                //
-               invocation.removeAttribute("subsession");
+               invocation.removeAttribute(ServerInvocation.REQUEST_SCOPE, "subsession");
 
                //
                if (ss == null)

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -28,6 +28,7 @@
 import org.jboss.portal.portlet.info.PortletInfo;
 import org.jboss.portal.portlet.info.SessionInfo;
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.server.ServerInvocation;
 
 import java.util.List;
 
@@ -44,7 +45,7 @@
 
       if (sessionInfo != null && Boolean.TRUE.equals(sessionInfo.getDistributed()))
       {
-         SubSession ss = (SubSession)invocation.getAttribute("subsession");
+         SubSession ss = (SubSession)invocation.getAttribute(ServerInvocation.REQUEST_SCOPE, "subsession");
 
          // If we detect an activation then we copy the content in the dispatched session
          if (ss != null)
@@ -68,7 +69,7 @@
             List modifications = SessionListener.desactivate();
 
             // Set modifications for portal session synchronization
-            invocation.setAttribute("subsession", modifications);
+            invocation.setAttribute(ServerInvocation.REQUEST_SCOPE, "subsession", modifications);
          }
       }
       else

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/WindowStatesInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,9 +21,9 @@
 */
 package org.jboss.portal.portlet.aspects.portlet;
 
+import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.portlet.invocation.PortletInterceptor;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.common.invocation.InvocationException;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -40,7 +40,7 @@
 
    protected void invoke(PortletInvocation invocation) throws Exception, InvocationException
    {
-      if (invocation.getContext().getWindowState() == null)
+      if (invocation.getPortletContext().getWindowState() == null)
       {
          throw new InvocationException("No window state has been provided");
       }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,7 +23,9 @@
 
 import org.jboss.portal.common.system.AbstractJBossService;
 import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.InterceptorStack;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationHandler;
 import org.jboss.portal.portlet.state.PropertyMap;
 import org.jboss.portal.portlet.state.PropertyChange;
 import org.jboss.portal.portlet.PortletInvoker;
@@ -52,8 +54,28 @@
    private PortletApplicationRegistry registry;
 
    /** . */
-   private InterceptorStack stack;
+   private InterceptorStackFactory stackFactory;
 
+   /** . */
+   private InvocationHandler handler = new InvocationHandler()
+   {
+      public void invoke(Invocation invocation) throws Exception, org.jboss.portal.common.invocation.InvocationException
+      {
+         PortletInvocation portletInvocation = (PortletInvocation)invocation;
+         try
+         {
+            portletInvocation.setHandler(null);
+            ContainerPortletInfo info = (ContainerPortletInfo)portletInvocation.getInfo();
+            PortletContainer container = info.getContainer();
+            container.dispatch(portletInvocation);
+         }
+         finally
+         {
+            portletInvocation.setHandler(this);
+         }
+      }
+   };
+
    public PortletApplicationRegistry getRegistry()
    {
       return registry;
@@ -64,14 +86,14 @@
       this.registry = registry;
    }
 
-   public InterceptorStack getStack()
+   public InterceptorStackFactory getStackFactory()
    {
-      return stack;
+      return stackFactory;
    }
 
-   public void setStack(InterceptorStack stack)
+   public void setStackFactory(InterceptorStackFactory stackFactory)
    {
-      this.stack = stack;
+      this.stackFactory = stackFactory;
    }
 
    public Set getPortlets()
@@ -106,10 +128,11 @@
 
    public void invoke(PortletInvocation invocation) throws PortletInvokerException, InvocationException
    {
+      InvocationHandler prevHandler = invocation.getHandler();
       try
       {
-         invocation.setDispatcher(dispatcher);
-         invocation.invoke(stack.getInterceptors());
+         invocation.setHandler(handler);
+         invocation.invoke(stackFactory.getInterceptorStack());
       }
       catch (Exception e)
       {
@@ -128,20 +151,10 @@
       }
       finally
       {
-         invocation.setDispatcher(null);
+         invocation.setHandler(prevHandler);
       }
    }
 
-   private final PortletInvocation.Dispatcher dispatcher = new PortletInvocation.Dispatcher()
-   {
-      public void dispatch(PortletInvocation invocation) throws PortletInvokerException
-      {
-         ContainerPortletInfo info = (ContainerPortletInfo)invocation.getInfo();
-         PortletContainer container = info.getContainer();
-         container.dispatch(invocation);
-      }
-   };
-
    public String createClone(String portletId) throws NoSuchPortletException
    {
       throw new UnsupportedOperationException();

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,19 +21,18 @@
 */
 package org.jboss.portal.portlet.impl.jsr168;
 
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.spi.ActionContext;
+
+import javax.portlet.ActionRequest;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 
-import javax.portlet.ActionRequest;
-
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.Parameters;
-
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
@@ -47,7 +46,7 @@
    public ActionRequestImpl(ActionInvocation invocation)
    {
       super(invocation);
-      this.actionContext = (ActionContext)invocation.getContext();
+      this.actionContext = (ActionContext)invocation.getPortletContext();
 
       // Get the possibly null interaction state
       StateString interactionState = actionContext.getInteractionState();

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,18 +23,18 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.Parameters;
 import org.jboss.portal.portlet.container.PortletApplicationImpl;
-import org.jboss.portal.portlet.state.PropertyContext;
 import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
 import org.jboss.portal.portlet.container.info.ContentTypes;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
 import org.jboss.portal.portlet.spi.InstanceContext;
 import org.jboss.portal.portlet.spi.RequestContext;
 import org.jboss.portal.portlet.spi.SecurityContext;
 import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.state.PropertyContext;
 
 import javax.portlet.PortalContext;
 import javax.portlet.PortletMode;
@@ -50,12 +50,12 @@
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
-import java.util.HashSet;
-import java.util.Iterator;
 
 /**
  * PortletRequest implemention. The parameter implementation is left
@@ -109,7 +109,7 @@
       this.parameters = null;
 
       int mode = this instanceof RenderRequest ? PortletPreferencesImpl.RENDER : PortletPreferencesImpl.ACTION;
-      PropertyContext prefs = (PropertyContext)invocation.getAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+      PropertyContext prefs = (PropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
       PreferencesValidator validator = container.getPreferencesValidator();
 
       this.preferences = new PortletPreferencesImpl(prefs, validator, mode);
@@ -175,13 +175,13 @@
 
    public WindowState getWindowState()
    {
-      String s = invocation.getContext().getWindowState().toString();
+      String s = invocation.getPortletContext().getWindowState().toString();
       return PortletURLImpl.decodeWindowState(s);
    }
 
    public PortletMode getPortletMode()
    {
-      String s = invocation.getContext().getMode().toString();
+      String s = invocation.getPortletContext().getMode().toString();
       return PortletURLImpl.decodePortletMode(s);
    }
 
@@ -383,7 +383,7 @@
 
    public String getResponseContentType()
    {
-      return invocation.getContext().getStreamInfo().getContentType().toString();
+      return invocation.getPortletContext().getStreamInfo().getContentType().toString();
    }
 
    public Enumeration getResponseContentTypes()

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,10 +21,10 @@
 */
 package org.jboss.portal.portlet.impl.jsr168;
 
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
 import javax.portlet.PortletResponse;
 
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
@@ -50,6 +50,6 @@
       {
          throw new IllegalArgumentException("URL must not be null");
       }
-      return invocation.getContext().encodeURL(url);
+      return invocation.getPortletContext().encodeURL(url);
    }
 }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,25 +21,24 @@
 */
 package org.jboss.portal.portlet.impl.jsr168;
 
-import java.util.Map;
+import org.jboss.portal.Mode;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
 
 import javax.portlet.PortletMode;
 import javax.portlet.PortletModeException;
+import javax.portlet.PortletRequest;
 import javax.portlet.PortletSecurityException;
 import javax.portlet.PortletURL;
 import javax.portlet.WindowState;
 import javax.portlet.WindowStateException;
-import javax.portlet.PortletRequest;
+import java.util.Map;
 
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.InvocationContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.Mode;
-
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
@@ -128,7 +127,7 @@
 
    public String toString()
    {
-      InvocationContext responseContext = inv.getContext();
+      PortletInvocationContext responseContext = inv.getPortletContext();
       String s = responseContext.encodeURL(url, secure, null, true);
       return s;
    }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,10 +21,10 @@
 */
 package org.jboss.portal.portlet.impl.jsr168;
 
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
 import org.jboss.portal.portlet.invocation.RenderInvocation;
 import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.StateString;
 
 import javax.portlet.RenderRequest;
 
@@ -44,7 +44,7 @@
       super(invocation);
 
       // Get the render context
-      renderContext = (RenderContext)invocation.getContext();
+      renderContext = (RenderContext)invocation.getPortletContext();
 
       // Get the possibly null navigational state
       StateString navigationalState = renderContext.getNavigationalState();

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,22 +21,21 @@
 */
 package org.jboss.portal.portlet.impl.jsr168;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Locale;
-
-import javax.portlet.PortletURL;
-import javax.portlet.RenderResponse;
-import javax.activation.MimeTypeParseException;
-
+import org.jboss.portal.common.MediaType;
+import org.jboss.portal.portlet.Properties;
 import org.jboss.portal.portlet.invocation.RenderInvocation;
 import org.jboss.portal.portlet.result.FragmentResult;
 import org.jboss.portal.portlet.result.Result;
 import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.portlet.Properties;
-import org.jboss.portal.common.MediaType;
 
+import javax.activation.MimeTypeParseException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Locale;
+
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
@@ -86,7 +85,7 @@
          MediaType requestedMediaType = MediaType.parseMimeType(contentType);
 
          // Get the response media type
-         HTTPStreamInfo info = invocation.getContext().getStreamInfo();
+         HTTPStreamInfo info = invocation.getPortletContext().getStreamInfo();
          MediaType responseMediaType = info.getContentType();
 
          // Check if the requested media type is allowed as a subtype of the main response
@@ -138,7 +137,7 @@
 
    public String getCharacterEncoding()
    {
-      return invocation.getContext().getStreamInfo().getCharset();
+      return invocation.getPortletContext().getStreamInfo().getCharset();
    }
 
    public Locale getLocale()

Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,114 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.portlet.impl.spi;
-
-import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.portlet.spi.InvocationContext;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-/**
- * An abstract implementation.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class AbstractInvocationContext implements InvocationContext
-{
-
-   /** Return the client request. */
-   public abstract HttpServletRequest getClientRequest();
-
-   /** Return the client response. */
-   public abstract HttpServletResponse getClientResponse();
-
-   /** Validate the url and then delegate the encoding of the url to the client response. */
-   public String encodeURL(String url) throws IllegalArgumentException
-   {
-      URLTools.enforceAbsoluteURL(url);
-      return getClientResponse().encodeURL(url);
-   }
-
-   public void setAttribute(Scope scope, String name, Object value)
-   {
-      if (name == null)
-      {
-         throw new IllegalArgumentException("No null name accepted");
-      }
-      if (SESSION_SCOPE == scope)
-      {
-         HttpSession session = getClientRequest().getSession();
-         if (value == null)
-         {
-            session.removeAttribute(name);
-         }
-         else
-         {
-            session.setAttribute(name, value);
-         }
-      }
-      else if (PRINCIPAL_SCOPE == scope)
-      {
-         HttpSession session = getClientRequest().getSession();
-         String userName = getClientRequest().getRemoteUser();
-         String key = userName == null ? "principal.." + name : "principal." + userName + "." + name;
-         if (value == null)
-         {
-            session.removeAttribute(key);
-         }
-         else
-         {
-            session.setAttribute(key, value);
-         }
-      }
-      else
-      {
-         throw new IllegalArgumentException("This scope cannot be accepted " + scope);
-      }
-   }
-
-   public Object getAttribute(Scope scope, String name)
-   {
-      if (name == null)
-      {
-         throw new IllegalArgumentException("No null name accepted");
-      }
-      if (SESSION_SCOPE == scope)
-      {
-         HttpSession session = getClientRequest().getSession();
-         return session.getAttribute(name);
-      }
-      if (PRINCIPAL_SCOPE == scope)
-      {
-         String userName = getClientRequest().getRemoteUser();
-         String key = userName == null ? "principal.." + name : "principal." + userName + "." + name;
-         HttpSession session = getClientRequest().getSession();
-         return session.getAttribute(key);
-      }
-      else
-      {
-         throw new IllegalArgumentException("This scope cannot be accepted " + scope);
-      }
-   }
-}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.portlet.impl.spi;
+
+import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * An abstract implementation.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5064 $
+ */
+public abstract class AbstractPortletInvocationContext extends AbstractInvocationContext implements PortletInvocationContext
+{
+
+   /** Return the client request. */
+   public abstract HttpServletRequest getClientRequest();
+
+   /** Return the client response. */
+   public abstract HttpServletResponse getClientResponse();
+
+   /** Validate the url and then delegate the encoding of the url to the client response. */
+   public String encodeURL(String url) throws IllegalArgumentException
+   {
+      URLTools.enforceAbsoluteURL(url);
+      return getClientResponse().encodeURL(url);
+   }
+}


Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -22,18 +22,19 @@
 package org.jboss.portal.portlet.invocation;
 
 import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.invocation.Scope;
+import org.jboss.portal.portlet.Properties;
+import org.jboss.portal.portlet.info.PortletInfo;
 import org.jboss.portal.portlet.result.Result;
-import org.jboss.portal.portlet.spi.InvocationContext;
+import org.jboss.portal.portlet.spi.InstanceContext;
 import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
 import org.jboss.portal.portlet.spi.RequestContext;
 import org.jboss.portal.portlet.spi.SecurityContext;
 import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.portlet.spi.InstanceContext;
 import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.Properties;
+import org.jboss.portal.server.ServerInvocation;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -47,6 +48,12 @@
 public abstract class PortletInvocation extends Invocation
 {
 
+   /** The portal principal scope. */
+   public static final Scope PRINCIPAL_SCOPE = new Scope("principal");
+
+   /** The request scope. */
+   public static final Scope REQUEST_SCOPE = ServerInvocation.REQUEST_SCOPE;
+
    /** The attribute name under which the portlet id can be accessed. */
    public static final String PORTLET_ID_ATTRIBUTE = "portletid";
 
@@ -62,9 +69,6 @@
    /** The attribute name under which the instance id can be accessed. */
    public static final String INSTANCE_ID_ATTRIBUTE = "instanceid";
 
-   /** The invocation context. */
-   protected InvocationContext invocationContext;
-
    /** The portal context. */
    protected PortalContext portalContext;
 
@@ -101,47 +105,35 @@
    /** The dispatched response. */
    protected HttpServletResponse dresp;
 
-   /** The dispatcher called at the end of the stack. */
-   protected Dispatcher dispatcher;
-
    /** The result. */
    protected Result result;
 
+   /** The invocation context. */
+   protected PortletInvocationContext ctx;
+
    /**
     * Create an invocation to a portlet.
     */
-   protected PortletInvocation(InvocationContext invocationContext)
+   protected PortletInvocation(PortletInvocationContext ctx)
    {
-      this.invocationContext = invocationContext;
+      if (ctx == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      this.ctx = ctx;
       this.properties = new Properties();
    }
 
-   /**
-    * Return the dispatcher of this invocation.
-    *
-    * @return the invocation dispatcher
-    */
-   public Dispatcher getDispatcher()
+   public InvocationContext getContext()
    {
-      return dispatcher;
+      return ctx;
    }
 
-   /**
-    * Set the dispatcher of this invocation.
-    */
-   public void setDispatcher(Dispatcher dispatcher)
+   public PortletInvocationContext getPortletContext()
    {
-      this.dispatcher = dispatcher;
+      return ctx;
    }
 
-   /**
-    * Return the invocation context.
-    */
-   public InvocationContext getContext()
-   {
-      return invocationContext;
-   }
-
    public Set getSupportedWindowStates()
    {
       return supportedWindowStates;
@@ -230,26 +222,6 @@
       this.dreq = dreq;
    }
 
-   /**
-    * Deliver call to the container.
-    */
-   protected void dispatch() throws Exception, InvocationException
-   {
-      if (dispatcher == null)
-      {
-         throw new InvocationException("No dispatcher");
-      }
-      dispatcher.dispatch(this);
-   }
-
-   /**
-    * A dispatcher for the portlet invocation.
-    */
-   public interface Dispatcher
-   {
-      void dispatch(PortletInvocation invocation) throws PortletInvokerException;
-   }
-
    public PortalContext getPortalContext()
    {
       return portalContext;

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -34,7 +34,7 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public interface ActionContext extends InvocationContext
+public interface ActionContext extends PortletInvocationContext
 {
    /**
     *

Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/spi/InvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/InvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/InvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,114 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.portlet.spi;
-
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface InvocationContext
-{
-   /**
-    * Returns the navigational state for this invocation.
-    *
-    * @return the navigational state
-    */
-   StateString getNavigationalState();
-
-   /**
-    * Returns the mode for this invocation.
-    *
-    * @return the mode
-    */
-   Mode getMode();
-
-   /**
-    * Returns the window state for this invocation.
-    *
-    * @return the window state
-    */
-   WindowState getWindowState();
-
-   /**
-    * Return information about the underlying http wire this invocation is performed.
-    *
-    * @return the stream info
-    */
-   HTTPStreamInfo getStreamInfo();
-
-   /**
-    * <p>Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
-    * The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL.
-    * For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.</p>
-    *
-    * <p>For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL
-    * rewriting cannot be used with browsers which do not support cookies.</p>
-    *
-    * @param url the url to be encoded
-    * @return the encoded URL if encoding is needed, the unchanged URL otherwise
-    * @throws IllegalArgumentException if the url is not valid or null
-    *
-    */
-   String encodeURL(String url) throws IllegalArgumentException;
-
-   /**
-    *
-    * @param portletURL the portlet url
-    * @param wantSecure
-    * @param wantAuthenticated
-    * @param relative
-    * @return the url
-    */
-   String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative);
-
-   void setAttribute(Scope scope, String name, Object value);
-
-   Object getAttribute(Scope scope, String name);
-
-   public class Scope
-   {
-
-      private final String name;
-
-      private Scope(String name)
-      {
-         this.name = name;
-      }
-
-      public String toString()
-      {
-         return name;
-      }
-   }
-
-   Scope INVOCATION_SCOPE = new Scope("invocation");
-
-   Scope SESSION_SCOPE = new Scope("session");
-
-   Scope PRINCIPAL_SCOPE = new Scope("principal");
-}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.portlet.spi;
+
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.invocation.InvocationContext;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5064 $
+ */
+public interface PortletInvocationContext extends InvocationContext
+{
+   /**
+    * Returns the navigational state for this invocation.
+    *
+    * @return the navigational state
+    */
+   StateString getNavigationalState();
+
+   /**
+    * Returns the mode for this invocation.
+    *
+    * @return the mode
+    */
+   Mode getMode();
+
+   /**
+    * Returns the window state for this invocation.
+    *
+    * @return the window state
+    */
+   WindowState getWindowState();
+
+   /**
+    * Return information about the underlying http wire this invocation is performed.
+    *
+    * @return the stream info
+    */
+   HTTPStreamInfo getStreamInfo();
+
+   /**
+    * <p>Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
+    * The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL.
+    * For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.</p>
+    *
+    * <p>For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL
+    * rewriting cannot be used with browsers which do not support cookies.</p>
+    *
+    * @param url the url to be encoded
+    * @return the encoded URL if encoding is needed, the unchanged URL otherwise
+    * @throws IllegalArgumentException if the url is not valid or null
+    *
+    */
+   String encodeURL(String url) throws IllegalArgumentException;
+
+   /**
+    *
+    * @param portletURL the portlet url
+    * @param wantSecure
+    * @param wantAuthenticated
+    * @param relative
+    * @return the url
+    */
+   String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative);
+}


Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -25,6 +25,6 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public interface RenderContext extends InvocationContext
+public interface RenderContext extends PortletInvocationContext
 {
 }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -162,7 +162,7 @@
    public void invoke(PortletInvocation invocation) throws PortletInvokerException, InvocationException
    {
       // Get the id of the portlet that the client want
-      String wantedPortletId = (String)invocation.getAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE);
+      String wantedPortletId = (String)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE);
       if (wantedPortletId == null)
       {
          throw new InvocationException("No portlet id provided");
@@ -244,8 +244,8 @@
       //
       try
       {
-         invocation.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, portletId);
-         invocation.setAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE, prefs);
+         invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, portletId);
+         invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE, prefs);
          invocation.setInfo(info);
 
          // Invoke
@@ -253,8 +253,8 @@
       }
       finally
       {
-         invocation.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, wantedPortletId);
-         invocation.removeAttribute(PortletInvocation.PREFERENCES_ATTRIBUTE);
+         invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, wantedPortletId);
+         invocation.removeAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE);
          invocation.setInfo(null);
       }
 

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -33,7 +33,7 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class ActionContextSupport extends InvocationContextSupport implements ActionContext
+public class ActionContextSupport extends PortletInvocationContextSupport implements ActionContext
 {
 
    public String getCharacterEncoding()

Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/InvocationContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/InvocationContextSupport.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/InvocationContextSupport.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,77 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.portlet.support.spi;
-
-import org.jboss.portal.portlet.spi.InvocationContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InvocationContextSupport implements InvocationContext
-{
-
-   public StateString getNavigationalState()
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public Mode getMode()
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public WindowState getWindowState()
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public HTTPStreamInfo getStreamInfo()
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public String encodeURL(String url) throws IllegalArgumentException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void setAttribute(Scope scope, String name, Object value)
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public Object getAttribute(Scope scope, String name)
-   {
-      throw new UnsupportedOperationException();
-   }
-}

Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.portlet.support.spi;
+
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.Scope;
+import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5064 $
+ */
+public class PortletInvocationContextSupport implements PortletInvocationContext
+{
+
+   public StateString getNavigationalState()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public Mode getMode()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public WindowState getWindowState()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public HTTPStreamInfo getStreamInfo()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public String encodeURL(String url) throws IllegalArgumentException
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public void setAttribute(Scope scope, String name, Object value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public Object getAttribute(Scope scope, String name)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public AttributeResolver getAttributeResolver(Scope attrScope) throws IllegalArgumentException
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public void removeAttribute(Scope attrScope, String attrName)
+   {
+      throw new UnsupportedOperationException();
+   }
+}


Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/RenderContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/RenderContextSupport.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/RenderContextSupport.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -27,6 +27,6 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class RenderContextSupport extends InvocationContextSupport implements RenderContext
+public class RenderContextSupport extends PortletInvocationContextSupport implements RenderContext
 {
 }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/tck/TCKPortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/tck/TCKPortletController.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/tck/TCKPortletController.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,18 +21,17 @@
 */
 package org.jboss.portal.portlet.tck;
 
-import org.jboss.portal.portlet.test.PortletController;
-import org.jboss.portal.portlet.PortletInvokerException;
 import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.test.PortletController;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerRequest;
 import org.jboss.portal.server.request.RequestParameter;
 
 import javax.servlet.http.HttpSession;
-import java.util.Collection;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -42,9 +41,8 @@
 {
    protected Collection getRenderList(ServerInvocation invocation) throws PortletInvokerException
    {
-      ServerRequest req = invocation.getRequest();
-      RequestParameter param = (RequestParameter)req.getContext().getParameterMap().get("portletName");
-      HttpSession session = req.getContext().getClientRequest().getSession();
+      RequestParameter param = (RequestParameter)invocation.getServerContext().getParameterMap().get("portletName");
+      HttpSession session = invocation.getServerContext().getClientRequest().getSession();
       List portletIds = null;
       if (param == null)
       {

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -36,7 +36,7 @@
 import org.jboss.portal.portlet.PortletURL;
 import org.jboss.portal.portlet.RenderURL;
 import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractInvocationContext;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
 import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
 import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
 import org.jboss.portal.portlet.invocation.ActionInvocation;
@@ -50,8 +50,8 @@
 import org.jboss.portal.portlet.result.Result;
 import org.jboss.portal.portlet.spi.ActionContext;
 import org.jboss.portal.portlet.spi.InstanceContext;
-import org.jboss.portal.portlet.spi.InvocationContext;
 import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
 import org.jboss.portal.portlet.spi.RenderContext;
 import org.jboss.portal.portlet.spi.RequestContext;
 import org.jboss.portal.portlet.spi.SecurityContext;
@@ -62,8 +62,6 @@
 import org.jboss.portal.server.RequestController;
 import org.jboss.portal.server.ServerException;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerResponse;
 import org.jboss.portal.server.request.RequestParameter;
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.server.request.URLFormat;
@@ -119,10 +117,8 @@
    {
       try
       {
-         ServerRequest req = invocation.getRequest();
+         String requestPath = invocation.getServerContext().getPortalRequestPath();
 
-         String requestPath = req.getContext().getPortalRequestPath();
-
          if (requestPath != null && requestPath.startsWith("/portlet/"))
          {
             // Get the portlet
@@ -130,12 +126,12 @@
             Portlet portlet = portletInvoker.getPortlet(portletId);
 
             PortletRequestDecoder decoder = new PortletRequestDecoder();
-            decoder.decode(req.getContext().getParameterMap());
+            decoder.decode(invocation.getServerContext().getParameterMap());
 
             if (decoder.getType() == PortletRequestDecoder.ACTION_TYPE)
             {
                // Get the navigational state if it exist
-               ParametersStateString navigationalState = (ParametersStateString)req.getNavigationContext().getNavigationalState(portlet.getId());
+               ParametersStateString navigationalState = (ParametersStateString)invocation.getAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId());
 
                //
                ActionContextImpl actionContext = new ActionContextImpl(
@@ -145,8 +141,8 @@
                   decoder.getInteractionState(),
                   decoder.getForm());
 
-               ActionInvocation action = createAction(actionContext);
-               action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, ((InstanceContextImpl)action.getInstanceContext()).getPortletOrCloneId());
+               ActionInvocation action = createAction(invocation, actionContext);
+               action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, ((InstanceContextImpl)action.getInstanceContext()).getPortletOrCloneId());
                portletInvoker.invoke(action);
                Result result = action.getResult();
                if (result instanceof RenderResult)
@@ -179,7 +175,7 @@
                            }
                         };
                         String url = actionContext.encodeURL(portletURL, null, null, false);
-                        invocation.getResponse().getContext().getClientResponse().sendRedirect(url);
+                        invocation.getServerContext().getClientResponse().sendRedirect(url);
                         return;
                      }
                      catch (IOException e)
@@ -189,7 +185,7 @@
                   }
                   else
                   {
-                     req.getNavigationContext().setNavigationalState(portlet.getId(), renderResult.getNavigationalState());
+                     invocation.setAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId(), renderResult.getNavigationalState());
                   }
                }
                if (result instanceof HTTPRedirectionResult)
@@ -197,7 +193,7 @@
                   try
                   {
                      HTTPRedirectionResult redirection = (HTTPRedirectionResult)result;
-                     invocation.getResponse().getContext().getClientResponse().sendRedirect(redirection.getLocation());
+                     invocation.getServerContext().getClientResponse().sendRedirect(redirection.getLocation());
                      return;
                   }
                   catch (IOException e)
@@ -211,7 +207,7 @@
                   error.logErrorTo(log, "An error occured during portlet invocation");
                   try
                   {
-                     invocation.getResponse().getContext().getClientResponse().sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                     invocation.getServerContext().getClientResponse().sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                      return;
                   }
                   catch (IOException e)
@@ -223,18 +219,18 @@
             else
             {
                //
-               req.getNavigationContext().setNavigationalState(portlet.getId(), decoder.getNavigationalstate());
+               invocation.setAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId(), decoder.getNavigationalstate());
 
                //
                if (decoder.getMode() != null)
                {
-                  req.getNavigationContext().setNavigationalState(portlet.getId() + "_mode", decoder.getMode());
+                  invocation.setAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId() + "_mode", decoder.getMode());
                }
 
                //
                if (decoder.getWindowState() != null)
                {
-                  req.getNavigationContext().setNavigationalState(portlet.getId() + "_windowstate", decoder.getWindowState());
+                  invocation.setAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId() + "_windowstate", decoder.getWindowState());
                }
             }
 
@@ -249,17 +245,17 @@
             Portlet portlet = (Portlet)i.next();
 
             // Get the navigational state
-            StateString ns = (StateString)invocation.getRequest().getNavigationContext().getNavigationalState(portlet.getId());
+            StateString ns = (StateString)invocation.getAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId());
 
             // Get the mode
-            Mode mode = (Mode)req.getNavigationContext().getNavigationalState(portlet.getId() + "_mode");
+            Mode mode = (Mode)invocation.getAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId() + "_mode");
             if (mode == null)
             {
                mode = Mode.VIEW;
             }
 
             // Get the window state
-            WindowState windowState = (WindowState)req.getNavigationContext().getNavigationalState(portlet.getId() + "_windowstate");
+            WindowState windowState = (WindowState)invocation.getAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getId() + "_windowstate");
             if (windowState == null)
             {
                windowState = WindowState.NORMAL;
@@ -269,12 +265,12 @@
             RenderContextImpl renderContext = new RenderContextImpl(portlet, invocation, ns, windowState, mode);
 
             //
-            PrintWriter writer = invocation.getResponse().getContext().getClientResponse().getWriter();
+            PrintWriter writer = invocation.getServerContext().getClientResponse().getWriter();
 
             //
             writer.write("<div>");
-            RenderInvocation render = createRender(renderContext);
-            render.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, ((InstanceContextImpl)render.getInstanceContext()).getPortletOrCloneId());
+            RenderInvocation render = createRender(invocation, renderContext);
+            render.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, ((InstanceContextImpl)render.getInstanceContext()).getPortletOrCloneId());
             portletInvoker.invoke(render);
             Result result = render.getResult();
             if (result instanceof FragmentResult)
@@ -306,7 +302,7 @@
                // Redirect to authed servlet
 
                // Compute the new url context
-               URLContext uctx = invocation.getRequest().getContext().getURLContext();
+               URLContext uctx = invocation.getServerContext().getURLContext();
                uctx = URLContext.newInstance(uctx.getSecure(), true);
 
                //
@@ -314,7 +310,7 @@
                url.setPortalRequestPath("/index.html");
 
                //
-               for (Iterator j = invocation.getRequest().getContext().getParameterMap().values().iterator(); j.hasNext();)
+               for (Iterator j = invocation.getServerContext().getParameterMap().values().iterator(); j.hasNext();)
                {
                   RequestParameter param = (RequestParameter)j.next();
                   url.setParameterValues(param.getName(), param.getValues());
@@ -324,7 +320,7 @@
                String s = invocation.getResponse().encodeURL(url, uctx);
 
                //
-               HttpServletResponse resp = invocation.getResponse().getContext().getClientResponse();
+               HttpServletResponse resp = invocation.getServerContext().getClientResponse();
                resp.sendRedirect(s);
                return;
             }
@@ -359,18 +355,17 @@
 
    protected void startRender(ServerInvocation invocation) throws ServletException, IOException
    {
-      ServerResponse resp = invocation.getResponse();
-      HttpServletResponse cresp = resp.getContext().getClientResponse();
+
+      HttpServletResponse cresp = invocation.getServerContext().getClientResponse();
       cresp.setContentType("text/html;charset=UTF-8");
       cresp.setCharacterEncoding("UTF-8");
-      PrintWriter writer = resp.getContext().getClientResponse().getWriter();
+      PrintWriter writer = invocation.getServerContext().getClientResponse().getWriter();
       writer.print("<html><body>");
    }
 
    protected void endRender(ServerInvocation invocation) throws ServletException, IOException
    {
-      ServerResponse resp = invocation.getResponse();
-      PrintWriter writer = resp.getContext().getClientResponse().getWriter();
+      PrintWriter writer = invocation.getServerContext().getClientResponse().getWriter();
       writer.print("</body></html>");
       writer.close();
    }
@@ -419,7 +414,7 @@
       }
    }
 
-   protected class RenderContextImpl extends InvocationContextImpl implements RenderContext
+   protected class RenderContextImpl extends PortletInvocationContextImpl implements RenderContext
    {
       public RenderContextImpl(
          Portlet portlet,
@@ -432,7 +427,7 @@
       }
    }
 
-   protected class ActionContextImpl extends InvocationContextImpl implements ActionContext
+   protected class ActionContextImpl extends PortletInvocationContextImpl implements ActionContext
    {
 
       private HttpServletRequest req;
@@ -449,7 +444,7 @@
          Parameters form)
       {
          super(portlet, invocation, navigationalState, windowState, mode);
-         req = invocation.getRequest().getContext().getClientRequest();
+         req = invocation.getServerContext().getClientRequest();
          this.interactionState = interactionState;
          this.form = form;
       }
@@ -490,27 +485,28 @@
       }
    }
 
-   public ActionInvocation createAction(ActionContext actionContext)
+   public ActionInvocation createAction(ServerInvocation serverInvocation, ActionContext actionContext)
    {
       ActionInvocation invocation = new ActionInvocation(actionContext);
-      update(invocation);
+      update(serverInvocation, invocation);
       return invocation;
    }
 
-   public RenderInvocation createRender(RenderContext renderContext)
+   public RenderInvocation createRender(ServerInvocation serverInvocation, RenderContext renderContext)
    {
       RenderInvocation invocation = new RenderInvocation(renderContext);
-      update(invocation);
+      update(serverInvocation, invocation);
       return invocation;
    }
 
-   public void update(PortletInvocation invocation)
+   public void update(final ServerInvocation serverInvocation, PortletInvocation invocation)
    {
-      final InvocationContextImpl invocationContext = (InvocationContextImpl)invocation.getContext();
+      final PortletInvocationContextImpl invocationContext = (PortletInvocationContextImpl)invocation.getPortletContext();
       PortalContext portalContext = new TestPortalContext();
-      SecurityContext securityContext = new AbstractSecurityContext(invocationContext.serverRequest.getContext().getClientRequest());
-      RequestContext requestContext = new AbstractRequestContext(invocationContext.serverRequest.getContext().getClientRequest(), invocationContext.serverResponse.getContext().getClientResponse());
-      InstanceContext instanceContext = new InstanceContextImpl(invocationContext.portlet, invocationContext.serverRequest.getContext().getClientRequest());
+      SecurityContext securityContext = new AbstractSecurityContext(invocationContext.getClientRequest());
+      RequestContext requestContext = new AbstractRequestContext(invocationContext.getClientRequest(), invocationContext.getClientResponse());
+      InstanceContext instanceContext = new InstanceContextImpl(invocationContext.portlet, invocationContext.getClientRequest());
+
       WindowContext windowContext = new WindowContext()
       {
          public String getId()
@@ -528,17 +524,17 @@
 
          public Map getInformations()
          {
-            return ((UserInterceptor.User)invocationContext.serverRequest.getUser()).getInformations();
+            return ((UserInterceptor.User)serverInvocation.getRequest().getUser()).getInformations();
          }
 
          public Locale getLocale()
          {
-            return invocationContext.serverRequest.getLocale();
+            return serverInvocation.getRequest().getLocale();
          }
 
          public List getLocales()
          {
-            return Tools.toList(invocationContext.serverRequest.getLocales());
+            return Tools.toList(serverInvocation.getRequest().getLocales());
          }
       };
 
@@ -551,18 +547,17 @@
       invocation.setUserContext(userContext);
    }
 
-   protected class InvocationContextImpl extends AbstractInvocationContext implements InvocationContext
+   protected class PortletInvocationContextImpl extends AbstractPortletInvocationContext implements PortletInvocationContext
    {
 
       protected Portlet portlet;
-      protected ServerRequest serverRequest;
-      protected ServerResponse serverResponse;
       protected StateString navigationalState;
+      protected ServerInvocation invocation;
 
       protected WindowState windowState;
       protected Mode mode;
 
-      public InvocationContextImpl(
+      public PortletInvocationContextImpl(
          Portlet portlet,
          ServerInvocation invocation,
          StateString navigationalState,
@@ -570,22 +565,26 @@
          Mode mode)
       {
          this.portlet = portlet;
-         this.serverRequest = invocation.getRequest();
-         this.serverResponse = invocation.getResponse();
          this.navigationalState = navigationalState;
          this.windowState = windowState;
          this.mode = mode;
 
+         //
+         this.invocation = invocation;
+
+         //
+         addResolver(ServerInvocation.REQUEST_SCOPE, invocation.getContext());
+         addResolver(ServerInvocation.PRINCIPAL_SCOPE, invocation.getContext());
       }
 
       public HttpServletResponse getClientResponse()
       {
-         return serverResponse.getContext().getClientResponse();
+         return invocation.getServerContext().getClientResponse();
       }
 
       public HttpServletRequest getClientRequest()
       {
-         return serverRequest.getContext().getClientRequest();
+         return invocation.getServerContext().getClientRequest();
       }
 
       public Mode getMode()
@@ -605,13 +604,13 @@
 
       public HTTPStreamInfo getStreamInfo()
       {
-         return serverResponse.getStreamInfo();
+         return invocation.getResponse().getStreamInfo();
       }
 
       public String encodeURL(String url)
       {
          URLTools.enforceAbsoluteURL(url);
-         return serverResponse.getContext().getClientResponse().encodeURL(url);
+         return invocation.getServerContext().getClientResponse().encodeURL(url);
       }
 
       public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
@@ -678,7 +677,7 @@
          }
 
          //
-         return serverResponse.encodeURL(serverURL, URLFormat.newInstance(relative, true));
+         return invocation.getResponse().encodeURL(serverURL, URLFormat.newInstance(relative, true));
       }
    }
 }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,11 @@
 */
 package org.jboss.portal.portlet.test;
 
-import org.jboss.portal.common.invocation.InterceptorStack;
 import org.jboss.portal.common.system.AbstractJBossService;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.InvocationHandler;
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.portlet.state.PropertyMap;
 import org.jboss.portal.portlet.state.PropertyChange;
 import org.jboss.portal.portlet.Portlet;
@@ -43,56 +46,37 @@
 {
 
    /** . */
-   private InterceptorStack stack;
+   private InterceptorStackFactory stackFactory;
 
    /** . */
    private PortletInvoker producer;
 
    /** . */
-   private PortletInvocation.Dispatcher dispatcher;
-
-   public TestPortletInvoker()
+   private InvocationHandler handler = new InvocationHandler()
    {
-      dispatcher = new PortletInvocation.Dispatcher()
+      public void invoke(Invocation invocation) throws Exception, InvocationException
       {
-         public void dispatch(PortletInvocation invocation) throws PortletInvokerException
+         PortletInvocation portletInvocation = (PortletInvocation)invocation;
+         try
          {
-            try
-            {
-               invocation.setDispatcher(null);
-               producer.invoke(invocation);
-            }
-            catch (Exception e)
-            {
-               if (e instanceof PortletInvokerException)
-               {
-                  throw (PortletInvokerException)e;
-               }
-               else if (e instanceof RuntimeException)
-               {
-                  throw (RuntimeException)e;
-               }
-               else
-               {
-                  throw new PortletInvokerException(e);
-               }
-            }
-            finally
-            {
-               invocation.setDispatcher(dispatcher);
-            }
+            portletInvocation.setHandler(null);
+            producer.invoke(portletInvocation);
          }
-      };
-   }
+         finally
+         {
+            portletInvocation.setHandler(this);
+         }
+      }
+   };
 
-   public InterceptorStack getStack()
+   public InterceptorStackFactory getStackFactory()
    {
-      return stack;
+      return stackFactory;
    }
 
-   public void setStack(InterceptorStack stack)
+   public void setStackFactory(InterceptorStackFactory stackFactory)
    {
-      this.stack = stack;
+      this.stackFactory = stackFactory;
    }
 
    public PortletInvoker getProducer()
@@ -117,10 +101,11 @@
 
    public void invoke(PortletInvocation invocation) throws PortletInvokerException
    {
+      InvocationHandler prevHandler = invocation.getHandler();
       try
       {
-         invocation.setDispatcher(dispatcher);
-         invocation.invoke(stack.getInterceptors());
+         invocation.setHandler(handler);
+         invocation.invoke(stackFactory.getInterceptorStack());
       }
       catch (Exception e)
       {
@@ -139,7 +124,7 @@
       }
       finally
       {
-         invocation.setDispatcher(null);
+         invocation.setHandler(prevHandler);
       }
    }
 

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/TestSecurityInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/TestSecurityInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/TestSecurityInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -57,7 +57,7 @@
       try
       {
          PortalAuthorizationManager authMgr = pamf.getManager();
-         String portletId = (String)invocation.getAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE);
+         String portletId = (String)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE);
          PortletPermission perm = new PortletPermission(portletId, PortletPermission.VIEW_MASK);
          boolean authorized = authMgr.checkPermission(perm);
          if (authorized == false)

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/UserInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/UserInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/UserInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,16 +21,16 @@
 */
 package org.jboss.portal.portlet.test;
 
+import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.server.ServerInterceptor;
 import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.common.invocation.InvocationException;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
+import java.io.Serializable;
+import java.util.HashMap;
 import java.util.Map;
-import java.util.HashMap;
-import java.io.Serializable;
 
 /**
  * The user interceptor is a simple implementation that is used to run the portlet controller.
@@ -45,7 +45,7 @@
    protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
    {
       ServerRequest sreq = invocation.getRequest();
-      HttpServletRequest hreq = sreq.getContext().getClientRequest();
+      HttpServletRequest hreq = invocation.getServerContext().getClientRequest();
       HttpSession session = hreq.getSession();
 
       //

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -85,7 +85,7 @@
 
    public void invoke(PortletInvocation invocation) throws PortletInvokerException
    {
-      String portletId = (String)invocation.getAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE);
+      String portletId = (String)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE);
       PortletSupport portlet = internalGetPortlet(portletId);
       portlet.invoke(invocation);
    }

Modified: trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/Sequence.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/Sequence.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/Sequence.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,6 +23,7 @@
 
 import org.jboss.portal.test.framework.portlet.actions.TestAction;
 import org.jboss.portal.test.framework.server.NodeId;
+import org.jboss.portal.test.framework.container.result.AssertResult;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -38,11 +39,15 @@
 {
 
    /** . */
-   private Map actionMap = null;
+   private Map actionMap;
 
+   /** . */
+   private AssertResult assertResult;
+
    public Sequence()
    {
       actionMap = new HashMap();
+      assertResult = new AssertResult();
    }
 
    public void addAction(int requestCount, Joinpoint joinpoint, TestAction action)

Modified: trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/PortletActionTestAction.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/PortletActionTestAction.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/actions/PortletActionTestAction.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -42,7 +42,8 @@
    {
       try
       {
-         return run(servlet, request, response);
+         run(servlet, request, response);
+         return null;
       }
       catch (Throwable t)
       {
@@ -50,6 +51,6 @@
       }
    }
 
-   protected abstract AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException;
+   protected abstract void run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException;
 
 }

Modified: trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/basictests/BasicTestSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/basictests/BasicTestSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/basictests/BasicTestSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,7 +21,6 @@
 */
 package org.jboss.portal.test.framework.portlet.basictests;
 
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.FailureResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
@@ -103,10 +102,9 @@
       });
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction(){
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             fail();
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionrequest/ActionRequestSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionrequest/ActionRequestSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionrequest/ActionRequestSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,7 +21,6 @@
 */
 package org.jboss.portal.test.portlet.jsr168.api.actionrequest;
 
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.Result;
@@ -92,7 +91,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             try
             {
@@ -111,8 +110,6 @@
             catch (IllegalArgumentException expected)
             {
             }
-
-            return null;
          }
       });
 
@@ -146,7 +143,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
 
             try
@@ -175,8 +172,6 @@
             catch (IllegalArgumentException e)
             {
             }
-
-            return null;
          }
       });
 
@@ -208,7 +203,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             try
             {
@@ -227,7 +222,6 @@
             catch (IllegalArgumentException expected)
             {
             }
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionresponse/ActionResponseSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionresponse/ActionResponseSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/actionresponse/ActionResponseSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -67,7 +67,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
 
             String val = null;
@@ -186,8 +186,6 @@
             {
                //
             }
-
-            return null;
          }
       });
 
@@ -195,9 +193,6 @@
       {
          protected Result run(Portlet portlet, RenderRequest request, RenderResponse response)
          {
-
-
-
             return new EndTestResult();
          }
       });
@@ -226,7 +221,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             try
             {
@@ -245,8 +240,6 @@
             catch (IllegalArgumentException expected)
             {
             }
-
-            return null;
          }
       });
 
@@ -277,7 +270,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             try
             {
@@ -287,8 +280,6 @@
             catch (IllegalArgumentException expected)
             {
             }
-
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/PortletPreferencesSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/PortletPreferencesSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/PortletPreferencesSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -24,7 +24,6 @@
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.portlet.Sequence;
 import org.jboss.portal.test.framework.portlet.SequenceRegistry;
 import org.jboss.portal.test.framework.portlet.SequenceRegistryBuilder;
@@ -94,7 +93,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException
          {
             PortletPreferences prefs = request.getPreferences();
 
@@ -181,8 +180,6 @@
             {
                //
             }
-
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletmode/PortletModeSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletmode/PortletModeSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletmode/PortletModeSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -29,7 +29,6 @@
 import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
 import org.jboss.portal.test.framework.container.result.Result;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.portlet.jsr168.ext.portletmode.extended.TestActionWithPortletModePortlet;
 
@@ -66,10 +65,9 @@
 
       seq.addAction(1, TestActionWithPortletModePortlet.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             assertEquals(PortletMode.EDIT, request.getPortletMode());
-            return null;
          }
       });
 
@@ -98,11 +96,10 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletModeException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletModeException
          {
             // Test we can set null portlet mode
             response.setPortletMode(null);
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestsSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestsSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestsSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -29,7 +29,6 @@
 import org.jboss.portal.test.framework.portlet.universal.UTP1;
 import org.jboss.portal.test.framework.container.result.Result;
 import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.common.util.Tools;
@@ -40,8 +39,6 @@
 import javax.portlet.PortletURL;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ByteArrayOutputStream;
@@ -94,7 +91,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             assertEquals(new String[]{"g_bar1_1"}, request.getParameterValues("g_foo1"));
             assertEquals(new String[]{"g_bar2_1", "g_bar2_2"}, request.getParameterValues("g_foo2"));
@@ -122,7 +119,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -164,7 +160,7 @@
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
 
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
 
             assertEquals(new String[]{"g_bar1_1"}, request.getParameterValues("g_foo1"));
@@ -202,7 +198,6 @@
             catch (IllegalStateException expected)
             {
             }
-            return null;
          }
       });
 
@@ -242,7 +237,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             assertEquals(new String[]{"g_bar1_1"}, request.getParameterValues("g_foo1"));
             assertEquals(new String[]{"g_bar2_1", "g_bar2_2"}, request.getParameterValues("g_foo2"));
@@ -279,7 +274,6 @@
             catch (IllegalStateException expected)
             {
             }
-            return null;
          }
       });
 
@@ -364,7 +358,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // The expected map
             Map expectedParameterMap = new HashMap();
@@ -387,7 +381,6 @@
             Set enumeration = Tools.toSet(request.getParameterNames());
             Set expectedEnumeration = Tools.toSet(new Object[]{"foo1", "foo2"});
             assertEquals(expectedEnumeration, enumeration);
-            return null;
          }
       });
 
@@ -447,7 +440,7 @@
 
       seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Test the header is here
             Set propertyNames = Tools.toSet(request.getPropertyNames());
@@ -457,13 +450,10 @@
             assertTrue(values.hasMoreElements());
             assertEquals("action-value", values.nextElement());
             assertFalse(values.hasMoreElements());
-
-            //
-            return new AssertResult();
          }
       });
 
-      seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+      seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
       {
          protected Result run(Portlet portlet, RenderRequest request, RenderResponse response)
          {

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -27,15 +27,12 @@
 import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
 import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
 import org.jboss.portal.test.framework.portlet.universal.UTP1;
-import org.jboss.portal.test.framework.portlet.universal.UTP10;
 import org.jboss.portal.test.framework.portlet.universal.UTP2;
-import org.jboss.portal.test.framework.portlet.universal.UTP9;
 import org.jboss.portal.test.framework.portlet.universal.UTP3;
 import org.jboss.portal.test.framework.portlet.universal.UTP4;
 import org.jboss.portal.test.framework.container.result.Result;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
 
 import javax.portlet.Portlet;
 import javax.portlet.RenderRequest;
@@ -82,7 +79,7 @@
       });
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             PortletPreferences prefs = request.getPreferences();
 
@@ -101,8 +98,6 @@
             // Check we still have the other value
             assertEquals("other", prefs.getValue("dynamic", "other"));
             assertEquals(new String[]{"other"}, prefs.getValues("dynamic", new String[]{"other"}));
-
-            return null;
          }
       });
       seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
@@ -146,7 +141,7 @@
 
       seq.addAction(1, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -154,7 +149,6 @@
             //assert that isReadOnly returns correct values
             assertEquals(true, prefs.isReadOnly("static_single_pref"));
             assertEquals(false, prefs.isReadOnly("static_multi_pref"));
-            return null;
          }
       });
 
@@ -182,7 +176,7 @@
 
       seq.addAction(1, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -201,7 +195,6 @@
 
             // Store
             prefs.store();
-            return null;
          }
       });
 
@@ -215,7 +208,7 @@
 
       seq.addAction(2, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -225,7 +218,6 @@
             assertEquals(new String[]{"new_static_multi_pref_value_1", "new_static_multi_pref_value_2"}, prefs.getValues("static_multi_pref", new String[]{"other"}));
             assertEquals("new_dynamic_single_pref_value", prefs.getValue("dynamic_single_pref", "other"));
             assertEquals(new String[]{"new_dynamic_multi_pref_value_1", "new_dynamic_multi_pref_value_2"}, prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
-            return null;
          }
       });
 
@@ -253,7 +245,7 @@
 
       seq.addAction(1, UTP3.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException
          {
             // Get prefs map
             PortletPreferences prefs = request.getPreferences();
@@ -294,7 +286,6 @@
             assertEquals(new String[]{null}, (Object[])map.get("single_pref"));
             assertTrue(map.containsKey("multi_pref"));
             assertEquals(new String[]{null}, (Object[])map.get("multi_pref"));
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -27,20 +27,16 @@
 import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
 import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
 import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.portlet.actions.TestAction;
 import org.jboss.portal.test.framework.portlet.universal.UTP1;
 import org.jboss.portal.test.framework.portlet.universal.UTS1;
-import org.jboss.portal.test.framework.portlet.universal.UTP2;
 import org.jboss.portal.test.framework.container.result.Result;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
 
 import javax.portlet.Portlet;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.PortletSession;
-import javax.portlet.PortletURL;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletException;
@@ -51,8 +47,6 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import java.io.IOException;
-import java.util.Enumeration;
-import java.util.regex.Pattern;
 
 /**
  * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -103,13 +97,12 @@
       });
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
          {
             PortletSession session = request.getPortletSession(false);
             assertNotNull(session);
             assertEquals("bar_1", session.getAttribute("foo_1"));
             session.setAttribute("foo_2", "bar_2");
-            return null;
          }
       });
       seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,7 +21,6 @@
 */
 package org.jboss.portal.test.portlet.jsr168.tck.dispatcher;
 
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.Result;
@@ -138,12 +137,11 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             //set some render params to test them in dispatcher include (precedense)
             response.setRenderParameter("key1", "differentValue");
             response.setRenderParameter("key3", "k3value1");
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,7 +21,6 @@
 */
 package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
 
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.FailureResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
@@ -177,10 +176,9 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             UTP1.local.set(Boolean.TRUE);
-            return null;
          }
       });
 
@@ -237,11 +235,10 @@
 
       seq.addAction(2, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             //mark action phase invokation
             UTP2.local.set(Boolean.TRUE);
-            return null;
          }
       });
 
@@ -344,11 +341,10 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
          {
             String path = request.getContextPath() + "/universalServletA";
             response.sendRedirect(path);
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -29,7 +29,7 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class  PortletRequestTestSuite
+public class PortletRequestTestSuite
 {
    public static Test suite()
    {

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -83,12 +83,11 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             //assert that we received parameters from render
             assertEquals("k1value1", request.getParameter("key1"));
             assertEquals(new String[]{"k2value1", "k2value2", "k2value3"}, request.getParameterValues("key2"));
-            return null;
          }
       });
 
@@ -124,12 +123,11 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             //set parameters for render phase
             response.setRenderParameter("key1", "k1value1");
             response.setRenderParameter("key2", new String[]{"k2value1", "k2value2", "k2value3"});
-            return null;
          }
       });
 
@@ -259,7 +257,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             assertEquals("k1value1", request.getParameter("key1"));
             //assert it returns one element array
@@ -268,7 +266,6 @@
             assertEquals(new String[]{"k2value1", "k2value2", "k2value3"}, request.getParameterValues("key2"));
             //assert it returns first array element
             assertEquals("k2value1", request.getParameter("key2"));
-            return null;
          }
       });
 
@@ -305,7 +302,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             String path = request.getContextPath();
             //empty string is allowed by spec if portlet is based in server root
@@ -316,7 +313,6 @@
                assertTrue(path.subSequence(0, 1).equals("/"));
                assertTrue(!path.subSequence(path.length() - 1, path.length()).equals("/"));
             }
-            return null;
          }
       });
 
@@ -357,11 +353,10 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             //in current testsuite there is no user authentication
             assertNull(request.getAuthType());
-            return null;
          }
       });
 
@@ -400,13 +395,12 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             Enumeration types = request.getResponseContentTypes();
 
             //assert that first element is retrieved as defined in spec
             assertEquals((String)types.nextElement(), request.getResponseContentType());
-            return null;
          }
       });
 
@@ -441,7 +435,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             request.getPortletInputStream();
             try
@@ -454,7 +448,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -469,7 +462,7 @@
 
       seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             request.getReader();
             try
@@ -482,7 +475,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -83,7 +83,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             try
             {
@@ -94,7 +94,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -127,7 +126,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletModeException, IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletModeException, IOException
          {
             response.setPortletMode(PortletMode.VIEW);
             try
@@ -139,7 +138,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -154,7 +152,7 @@
 
       seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException, WindowStateException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException, WindowStateException
          {
             response.setWindowState(WindowState.NORMAL);
             try
@@ -166,7 +164,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -181,7 +178,7 @@
 
       seq.addAction(3, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             response.setRenderParameter("key", "value");
             try
@@ -193,7 +190,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -208,7 +204,7 @@
 
       seq.addAction(4, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             Map map = new HashMap();
             map.put("key", new String[]{"value"});
@@ -222,7 +218,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -256,7 +251,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             try
             {
@@ -267,7 +262,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -300,7 +294,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             try
             {
@@ -311,7 +305,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -345,7 +338,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException, PortletModeException, WindowStateException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException, PortletModeException, WindowStateException
          {
             response.sendRedirect(request.getContextPath() + "/universalServletA");
 
@@ -368,7 +361,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -412,13 +404,12 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             response.setRenderParameter("key1", "some strange value to overwrite");
             response.setRenderParameter("key2", "some strange value to overwrite 2");
             response.setRenderParameter("key1", "k1value1");
             response.setRenderParameter("key2", new String[]{"k2value1", "k2value2", "k2value3"});
-            return null;
          }
       });
 
@@ -468,7 +459,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             response.sendRedirect(request.getContextPath() + "/universalServletA");
 
@@ -493,7 +484,6 @@
             {
                //expected
             }
-            return null;
          }
       });
 
@@ -754,7 +744,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws IOException
          {
             response.sendRedirect(request.getContextPath() + "/universalServletB");
             //this should be propagated to the portlet to not invoke redirection

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,7 +21,6 @@
 */
 package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
 
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.Result;
@@ -143,11 +142,10 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             assertEquals("k1value1", request.getPortletSession().getAttribute("key1", PortletSession.APPLICATION_SCOPE));
             assertEquals("k2value1", request.getPortletSession().getAttribute("key2"));
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,7 +21,6 @@
 */
 package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
 
-import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.EndTestResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.Result;
@@ -71,11 +70,10 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             //this shouldn't be invoked
             UTP1.local.set(Boolean.TRUE);
-            return null;
          }
       });
 
@@ -122,11 +120,10 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             assertEquals("k1value1", request.getParameter("key1"));
             assertEquals(new String[]{"k2value1", "k2value2", "k2value3"}, request.getParameterValues("key2"));
-            return null;
          }
       });
 
@@ -149,7 +146,7 @@
 
       seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             //what was in previous request
             assertNull(request.getParameter("key1"));
@@ -158,7 +155,6 @@
             //what is now
             assertEquals("k3value1", request.getParameter("key3"));
             assertEquals(new String[]{"k4value1", "k4value2", "k4value3"}, request.getParameterValues("key4"));
-            return null;
          }
       });
 
@@ -278,10 +274,9 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             assertEquals(((Boolean)UTP1.holder).booleanValue(), request.isSecure());
-            return null;
          }
       });
 

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -79,7 +79,7 @@
 
       seq.addAction(1, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -103,8 +103,6 @@
             // Test with new value after store
             assertEquals(null, prefs.getValue("action_single_pref", "other"));
             assertEquals(null, prefs.getValue("action_multi_pref", "other"));
-
-            return null;
          }
       });
 
@@ -118,7 +116,7 @@
 
       seq.addAction(2, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -126,7 +124,6 @@
             // Test with new values
             assertEquals(null, prefs.getValue("action_single_pref", "other"));
             assertEquals(null, prefs.getValue("action_multi_pref", "other"));
-            return null;
          }
       });
 
@@ -159,7 +156,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs map
             PortletPreferences prefs = request.getPreferences();
@@ -179,8 +176,6 @@
             //
             assertEquals("single_pref_value", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"multi_pref_value_1", "multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -214,7 +209,7 @@
 
       seq.addAction(1, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -230,7 +225,6 @@
 
             // Test with new value
             assertEquals("dynamic", prefs.getValue("pref", "other"));
-            return null;
          }
       });
 
@@ -244,7 +238,7 @@
 
       seq.addAction(2, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -263,7 +257,6 @@
 
             // Test the value does not exist anymore
             assertEquals("other", prefs.getValue("pref", "other"));
-            return null;
          }
       });
 
@@ -277,14 +270,13 @@
 
       seq.addAction(3, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
 
             // Test the value does not exist anymore
             assertEquals("other", prefs.getValue("pref", "other"));
-            return null;
          }
       });
 
@@ -316,7 +308,7 @@
 
       seq.addAction(1, UTP5.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -384,8 +376,6 @@
             // Test values have not changed
             assertEquals("single_pref_value", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"multi_pref_value_1", "multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -417,7 +407,7 @@
 
       seq.addAction(1, UTP3.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -439,7 +429,6 @@
             assertEquals(new String[]{"new_static_multi_pref_value_1", "new_static_multi_pref_value_2"}, prefs.getValues("static_multi_pref", new String[]{"other"}));
             assertEquals("new_dynamic_single_pref_value", prefs.getValue("dynamic_single_pref", "other"));
             assertEquals(new String[]{"new_dynamic_multi_pref_value_1", "new_dynamic_multi_pref_value_2"}, prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
-            return null;
          }
       });
 
@@ -453,7 +442,7 @@
 
       seq.addAction(2, UTP3.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -463,8 +452,6 @@
             assertEquals(new String[]{"static_multi_pref_value_1", "static_multi_pref_value_2"}, prefs.getValues("static_multi_pref", new String[]{"other"}));
             assertEquals("other", prefs.getValue("dynamic_single_pref", "other"));
             assertEquals(new String[]{"other"}, prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -526,7 +513,7 @@
 
       seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -550,8 +537,6 @@
             // Test with new values after store
             assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -565,7 +550,7 @@
 
       seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -573,8 +558,6 @@
             // Test with new values
             assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -608,7 +591,7 @@
 
       seq.addAction(1, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -631,8 +614,6 @@
             // Test the value are good after store
             assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -646,7 +627,7 @@
 
       seq.addAction(2, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -669,7 +650,6 @@
             // Test does not exist after store
             assertEquals("other", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"other"}, prefs.getValues("multi_pref", new String[]{"other"}));
-            return null;
          }
       });
 
@@ -683,7 +663,7 @@
 
       seq.addAction(3, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -691,8 +671,6 @@
             // Test the values does not exist
             assertEquals("other", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"other"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -746,7 +724,7 @@
 
       seq.addAction(1, UTP8.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException, ValidatorException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -773,8 +751,6 @@
             // Test with new values after store
             assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -788,7 +764,7 @@
 
       seq.addAction(2, UTP8.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -796,8 +772,6 @@
             // Test with new values
             assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 
@@ -831,7 +805,7 @@
 
       seq.addAction(1, UTP7.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response) throws ReadOnlyException, IOException
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -856,7 +830,6 @@
                assertEquals("message", e.getMessage());
                assertFalse(e.getFailedKeys().hasMoreElements());
             }
-            return null;
          }
       });
 
@@ -870,7 +843,7 @@
 
       seq.addAction(2, UTP7.ACTION_JOINPOINT, new PortletActionTestAction()
       {
-         protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response)
+         protected void run(Portlet portlet, ActionRequest request, ActionResponse response)
          {
             // Get prefs
             PortletPreferences prefs = request.getPreferences();
@@ -879,8 +852,6 @@
             assertEquals("single_pref_value", prefs.getValue("single_pref", "other"));
             assertEquals(new String[]{"multi_pref_value_1", "multi_pref_value_2"},
                prefs.getValues("multi_pref", new String[]{"other"}));
-
-            return null;
          }
       });
 

Modified: trunk/portlet/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -11,12 +11,23 @@
 
    <!-- Server stack -->
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Server"
+      code="org.jboss.portal.server.aspects.server.ControllerInterceptor"
+      name="portal:service=Interceptor,type=Server,name=Controller"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
+      <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Server"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+      <xmbean/>
+      <depends-list optional-attribute-name="InterceptorNames">
+         <depends-list-element>portal:service=Interceptor,type=Server,name=Controller</depends-list-element>
+      </depends-list>
+   </mbean>
 
    <!-- Server deployer -->
    <mbean

Modified: trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -24,15 +24,16 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.aspects.server.NavigationInterceptor"
-      name="portal:service=Interceptor,type=Server,name=Navigation"
+      code="org.jboss.portal.server.aspects.server.ControllerInterceptor"
+      name="portal:service=Interceptor,type=Server,name=Controller"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
+      <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request,redirect=true</depends>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Server"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Server"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -40,7 +41,7 @@
          <depends-list-element>portal:service=Interceptor,type=Server,name=User</depends-list-element>
          <depends-list-element>portal:service=Interceptor,type=Server,name=Locale</depends-list-element>
          <depends-list-element>portal:service=Interceptor,type=Server,name=ContentType</depends-list-element>
-         <depends-list-element>portal:service=Interceptor,type=Server,name=Navigation</depends-list-element>
+         <depends-list-element>portal:service=Interceptor,type=Server,name=Controller</depends-list-element>
       </depends-list>
    </mbean>
 
@@ -60,8 +61,8 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Consumer"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Consumer"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -71,7 +72,7 @@
       </depends-list>
    </mbean>
 
-   <!-- Container stack-->
+   <!-- Producer stack-->
    <mbean
       code="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor"
       name="portal:service=Interceptor,type=Portlet,name=Valve"
@@ -122,8 +123,8 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Container"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Container"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -156,7 +157,7 @@
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
       <depends optional-attribute-name="Producer" proxy-type="attribute">portal:service=PortletInvoker,type=Producer</depends>
-      <depends optional-attribute-name="Stack" proxy-type="attribute">portal:service=InterceptorStack,type=Consumer</depends>
+      <depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Consumer</depends>
    </mbean>
 
    <!-- The producer portlet invoker -->
@@ -177,7 +178,7 @@
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
-      <depends optional-attribute-name="Stack" proxy-type="attribute">portal:service=InterceptorStack,type=Container</depends>
+      <depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Container</depends>
       <depends optional-attribute-name="Registry" proxy-type="attribute">portal:service=WebAppRegistry</depends>
    </mbean>
 
@@ -250,7 +251,7 @@
    </mbean>
 
 
-   <!--Things from portal-server.sar - jboss-service.xml-->
+   <!-- Things from portal-server.sar - jboss-service.xml-->
 
    <!-- Server configuration service -->
    <mbean
@@ -262,7 +263,6 @@
       <attribute name="ConfigLocation">conf/config.xml</attribute>
    </mbean>
 
-
    <!-- Server -->
    <mbean
       code="org.jboss.portal.server.impl.ServerImpl"
@@ -301,5 +301,4 @@
       <xmbean/>
       <depends optional-attribute-name="InterceptedDeployer">jboss.web:service=WebServer</depends>
    </mbean>
-   
 </server>

Modified: trunk/portlet/src/resources/test-war/WEB-INF/web.xml
===================================================================
--- trunk/portlet/src/resources/test-war/WEB-INF/web.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/portlet/src/resources/test-war/WEB-INF/web.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -15,11 +15,6 @@
          <param-value>false</param-value>
          <description>The servlet needs to know wether it is set as a default servlet or not</description>
       </init-param>
-      <init-param>
-         <param-name>controllerName</param-name>
-         <param-value>portal:controller=Request,redirect=true</param-value>
-         <description>The request controller for the portal servlet</description>
-      </init-param>
       <load-on-startup>0</load-on-startup>
       <security-role-ref>
         <role-name>Test</role-name>
@@ -36,11 +31,6 @@
          <param-value>false</param-value>
          <description>The servlet needs to know wether it is set as a default servlet or not</description>
       </init-param>
-      <init-param>
-         <param-name>controllerName</param-name>
-         <param-value>portal:controller=Request,redirect=false</param-value>
-         <description>The request controller for the portal servlet</description>
-      </init-param>
       <load-on-startup>0</load-on-startup>
       <security-role-ref>
         <role-name>Test</role-name>

Modified: trunk/server/src/main/org/jboss/portal/server/ServerInvocation.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerInvocation.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/ServerInvocation.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -22,7 +22,8 @@
 package org.jboss.portal.server;
 
 import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.invocation.Scope;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -31,51 +32,63 @@
 public class ServerInvocation extends Invocation
 {
 
+   /** . */
+   public static final Scope PRINCIPAL_SCOPE = new Scope("principal");
+
+   /** . */
+   public static final Scope SESSION_SCOPE = new Scope("session");
+
+   /** . */
+   public static final Scope REQUEST_SCOPE = new Scope("request");
+
+   /** . */
+   public static final Scope NAVIGATIONAL_STATE_SCOPE = new Scope("navigationalstate");
+
    /** The request. */
    private ServerRequest req;
 
    /** The response. */
    private ServerResponse resp;
 
-   /** The request controller. */
-   private RequestController controller;
+   /** The invocation context. */
+   private ServerInvocationContext ctx;
 
-   public ServerRequest getRequest()
+   public ServerInvocation(ServerInvocationContext ctx)
    {
-      return req;
+      if (ctx == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      this.ctx = ctx;
    }
 
-   public void setRequest(ServerRequest req)
+   public ServerInvocationContext getServerContext()
    {
-      this.req = req;
+      return ctx;
    }
 
-   public ServerResponse getResponse()
+   public InvocationContext getContext()
    {
-      return resp;
+      return ctx;
    }
 
-   public void setResponse(ServerResponse resp)
+   public ServerRequest getRequest()
    {
-      this.resp = resp;
+      return req;
    }
 
-   public RequestController getController()
+   public void setRequest(ServerRequest req)
    {
-      return controller;
+      this.req = req;
    }
 
-   public void setController(RequestController controller)
+   public ServerResponse getResponse()
    {
-      this.controller = controller;
+      return resp;
    }
 
-   protected void dispatch() throws Exception, InvocationException
+   public void setResponse(ServerResponse resp)
    {
-      if (controller == null)
-      {
-         throw new InvocationException("No controller");
-      }
-      controller.handle(this);
+      this.resp = resp;
    }
 }

Added: trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,88 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server;
+
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ServerInvocationContext extends InvocationContext
+{
+   /**
+    * Return the request that made the connection to the server.
+    */
+   HttpServletRequest getClientRequest();
+
+   /**
+    * The original servlet response.
+    *
+    * @return the http response
+    */
+   HttpServletResponse getClientResponse();
+
+   /**
+    * Return the parameter map.
+    */
+   Map getParameterMap();
+
+   /**
+    * Return the normalized media type of the request or null if none has been provided by the client.
+    */
+   String getMediaType();
+
+   /**
+    * Return the charset of the request or null if none has been provided by the client.
+    */
+   // Charset getCharset();
+
+   /**
+    * Return the url context of this request.
+    */
+   URLContext getURLContext();
+
+   /**
+    * Return the value of the portal request path for this request.
+    */
+   String getPortalRequestPath();
+
+   /**
+    * Return the value of the portal context path for this request.
+    */
+   String getPortalContextPath();
+
+   /**
+    *
+    * @param url
+    * @param context
+    * @param format
+    * @return the encoded url
+    */
+   String encodeURL(ServerURL url, URLContext context, URLFormat format);
+}

Added: trunk/server/src/main/org/jboss/portal/server/ServerInvocationContextFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerInvocationContextFactory.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/ServerInvocationContextFactory.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ServerInvocationContextFactory
+{
+   /**
+    *
+    */
+   ServerInvocationContext newInvocationContext(HttpServletRequest req, HttpServletResponse resp);
+}

Modified: trunk/server/src/main/org/jboss/portal/server/ServerRequest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerRequest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/ServerRequest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,6 @@
 */
 package org.jboss.portal.server;
 
-import org.jboss.portal.server.navigation.NavigationalStateContext;
-
 import java.util.Locale;
 
 /**
@@ -35,33 +33,16 @@
    /** The request user. */
    protected Object user;
 
-   /** The navigation context. */
-   protected NavigationalStateContext navigationContext;
-
-   /** The request context. */
-   protected ServerRequestContext reqContext;
-
    /** The locales for the scope of the current request. */
    protected Locale[] locales;
 
    /** The server used during the request. */
    protected Server server;
 
-   public ServerRequest(ServerRequestContext reqContext)
+   public ServerRequest()
    {
-      this.reqContext = reqContext;
    }
 
-   public NavigationalStateContext getNavigationContext()
-   {
-      return navigationContext;
-   }
-
-   public void setNavigationContext(NavigationalStateContext navigationContext)
-   {
-      this.navigationContext = navigationContext;
-   }
-
    public Object getUser()
    {
       return user;
@@ -72,11 +53,6 @@
       this.user = user;
    }
 
-   public ServerRequestContext getContext()
-   {
-      return reqContext;
-   }
-
    public Server getServer()
    {
       return server;

Deleted: trunk/server/src/main/org/jboss/portal/server/ServerRequestContext.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerRequestContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/ServerRequestContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,71 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.server;
-
-import org.jboss.portal.server.request.URLContext;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Map;
-import java.nio.charset.Charset;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface ServerRequestContext
-{
-
-   /**
-    * Return the parameter map.
-    */
-   Map getParameterMap();
-
-   /**
-    * Return the normalized media type of the request or null if none has been provided by the client.
-    */
-   String getMediaType();
-
-   /**
-    * Return the charset of the request or null if none has been provided by the client.
-    */
-   // Charset getCharset();
-
-   /**
-    * Return the url context of this request. 
-    */
-   URLContext getURLContext();
-
-   /**
-    * Return the request that made the connection to the server.
-    */
-   HttpServletRequest getClientRequest();
-
-   /**
-    * Return the value of the portal request path for this request.
-    */
-   String getPortalRequestPath();
-
-   /**
-    * Return the value of the portal context path for this request.
-    */
-   String getPortalContextPath();
-}

Modified: trunk/server/src/main/org/jboss/portal/server/ServerResponse.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerResponse.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/ServerResponse.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,9 +21,9 @@
 */
 package org.jboss.portal.server;
 
-import org.jboss.portal.server.util.HTTPStreamInfo;
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.server.util.HTTPStreamInfo;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -35,30 +35,21 @@
    /** The server request. */
    protected ServerRequest req;
 
-   /** The request context. */
-   protected ServerRequestContext reqContext;
-
-   /** The response context. */
-   protected ServerResponseContext respContext;
-
    /** . */
    protected HTTPStreamInfo streamInfo;
 
    /** Indicate that the invocation requires a sign out of the current authenticated user. */
    boolean wantSignOut;
 
-   public ServerResponse(ServerRequest req, ServerResponseContext respContext)
+   /** . */
+   protected ServerInvocationContext invocationCtx;
+
+   public ServerResponse(ServerRequest req, ServerInvocationContext invocationCtx)
    {
       this.req = req;
-      this.reqContext = req.getContext();
-      this.respContext = respContext;
+      this.invocationCtx = invocationCtx;
    }
 
-   public ServerResponseContext getContext()
-   {
-      return respContext;
-   }
-
    public HTTPStreamInfo getStreamInfo()
    {
       return streamInfo;
@@ -81,7 +72,7 @@
 
    public String encodeURL(ServerURL url)
    {
-      return respContext.encodeURL(url, req.getContext().getURLContext(), URLFormat.RELATIVE_ENC);
+      return invocationCtx.encodeURL(url, invocationCtx.getURLContext(), URLFormat.RELATIVE_ENC);
    }
 
    public String encodeURL(ServerURL url, URLFormat format)
@@ -90,28 +81,28 @@
       {
          format = URLFormat.RELATIVE_ENC;
       }
-      return respContext.encodeURL(url, req.getContext().getURLContext(), format);
+      return invocationCtx.encodeURL(url, invocationCtx.getURLContext(), format);
    }
 
    public String encodeURL(ServerURL url, URLContext context, URLFormat format)
    {
       if (context == null)
       {
-         context = req.getContext().getURLContext();
+         context = invocationCtx.getURLContext();
       }
       if (format == null)
       {
          format = URLFormat.RELATIVE_ENC;
       }
-      return respContext.encodeURL(url, context, format);
+      return invocationCtx.encodeURL(url, context, format);
    }
 
    public String encodeURL(ServerURL url, URLContext context)
    {
       if (context == null)
       {
-         context = req.getContext().getURLContext();
+         context = invocationCtx.getURLContext();
       }
-      return respContext.encodeURL(url, context, URLFormat.RELATIVE_ENC);
+      return invocationCtx.encodeURL(url, context, URLFormat.RELATIVE_ENC);
    }
 }

Deleted: trunk/server/src/main/org/jboss/portal/server/ServerResponseContext.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerResponseContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/ServerResponseContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,52 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.server;
-
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.request.URLFormat;
-
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Spi interface for URL generation.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface ServerResponseContext
-{
-   /**
-    * The original servlet response.
-    *
-    * @return the http response
-    */
-   HttpServletResponse getClientResponse();
-
-   /**
-    *
-    * @param url
-    * @param context
-    * @param format
-    * @return the encoded url
-    */
-   String encodeURL(ServerURL url, URLContext context, URLFormat format);
-}

Modified: trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,13 +21,14 @@
 */
 package org.jboss.portal.server.aspects.server;
 
+import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.server.ServerException;
 import org.jboss.portal.server.ServerInterceptor;
 import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.ServerResponse;
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.common.MediaType;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.UnsupportedEncodingException;
@@ -48,7 +49,8 @@
       try
       {
          // Set UTF-8 for parameter decoding
-         HttpServletRequest req = invocation.getRequest().getContext().getClientRequest();
+         ServerInvocationContext context = invocation.getServerContext();
+         HttpServletRequest req = context.getClientRequest();
          req.setCharacterEncoding("UTF-8");
       }
       catch (UnsupportedEncodingException e)

Added: trunk/server/src/main/org/jboss/portal/server/aspects/server/ControllerInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/ControllerInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/ControllerInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.aspects.server;
+
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerInterceptor;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.common.invocation.InvocationException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ControllerInterceptor extends ServerInterceptor
+{
+
+   /** . */
+   private RequestController controller;
+
+   public RequestController getController()
+   {
+      return controller;
+   }
+
+   public void setController(RequestController controller)
+   {
+      this.controller = controller;
+   }
+
+   protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
+   {
+      if (controller == null)
+      {
+         throw new InvocationException("No controller");
+      }
+      controller.handle(invocation);
+   }
+}

Modified: trunk/server/src/main/org/jboss/portal/server/aspects/server/LocaleInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/LocaleInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/LocaleInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,10 +21,11 @@
 */
 package org.jboss.portal.server.aspects.server;
 
+import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.server.ServerInterceptor;
 import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.common.invocation.InvocationException;
 
 import java.util.Locale;
 
@@ -40,7 +41,8 @@
    protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
    {
       ServerRequest req = invocation.getRequest();
-      Locale locale = req.getContext().getClientRequest().getLocale();
+      ServerInvocationContext context = invocation.getServerContext();
+      Locale locale = context.getClientRequest().getLocale();
       try
       {
          req.setLocales(new Locale[]{locale});

Modified: trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,51 +21,10 @@
 */
 package org.jboss.portal.server.aspects.server;
 
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.server.ServerInterceptor;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class NavigationInterceptor extends ServerInterceptor
+public class NavigationInterceptor
 {
-
-   protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
-   {
-      ServerRequest sreq = invocation.getRequest();
-
-      //
-      try
-      {
-         // Get the session out of the command
-         HttpServletRequest hreq = sreq.getContext().getClientRequest();
-         HttpSession session = hreq.getSession();
-
-         // Associate with the session
-         // it is asserted that the underlying server impl guarantees that the getAttribute is performed in a synchronized manner
-         NavigationalStateContext ctx = (NavigationalStateContext)session.getAttribute("NAV");
-         if (ctx == null)
-         {
-            ctx = new NavigationalStateContext();
-            session.setAttribute("NAV", ctx);
-         }
-
-         //
-         sreq.setNavigationContext(ctx);
-
-         //
-         invocation.invokeNext();
-      }
-      finally
-      {
-         sreq.setNavigationContext(null);
-      }
-   }
 }

Modified: trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionInvalidatorInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -25,6 +25,7 @@
 import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.server.ServerInterceptor;
 import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.servlet.CommandServlet;
 import org.jboss.portal.server.servlet.ServletCommand;
 
@@ -100,7 +101,8 @@
    private void after(ServerInvocation invocation)
    {
       // Put the contexts that have been used during this invocation into the global set
-      HttpSession session = invocation.getRequest().getContext().getClientRequest().getSession();
+      ServerInvocationContext context = invocation.getServerContext();
+      HttpSession session = context.getClientRequest().getSession();
       Set contexts = (Set)session.getAttribute(KEY);
       if (contexts == null)
       {
@@ -162,8 +164,9 @@
 
       public DispatcherImpl(ServerInvocation invocation)
       {
-         req = invocation.getRequest().getContext().getClientRequest();
-         resp = invocation.getResponse().getContext().getClientResponse();
+         ServerInvocationContext context = invocation.getServerContext();
+         req = context.getClientRequest();
+         resp = context.getClientResponse();
       }
 
       public void include(RequestDispatcher rd) throws IOException, ServletException

Added: trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,99 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.impl;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractSessionAttributeResolver implements AttributeResolver
+{
+
+   /** . */
+   protected final HttpServletRequest req;
+
+   public AbstractSessionAttributeResolver(HttpServletRequest req)
+   {
+      if (req == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      this.req = req;
+   }
+
+   public Object getAttribute(String attrName) throws IllegalArgumentException
+   {
+      if (attrName == null)
+      {
+         throw new IllegalArgumentException();
+      }
+
+      //
+      Object value = null;
+      HttpSession session = req.getSession(false);
+      if (session != null)
+      {
+         String attrKey = createAttributeKey(attrName);
+         value = session.getAttribute(attrKey);
+      }
+      return value;
+   }
+
+   public void setAttribute(String attrName, Object attrValue) throws IllegalArgumentException
+   {
+      if (attrName == null)
+      {
+         throw new IllegalArgumentException();
+      }
+
+      //
+      HttpSession session = req.getSession(false);
+      if (session != null)
+      {
+         String attrKey = createAttributeKey(attrName);
+         if (attrValue != null)
+         {
+            session.setAttribute(attrKey, attrValue);
+         }
+         else
+         {
+            session.removeAttribute(attrKey);
+         }
+      }
+      else
+      {
+         if (attrValue != null)
+         {
+            String attrKey = createAttributeKey(attrName);
+            session = req.getSession();
+            session.setAttribute(attrKey, attrValue);
+         }
+      }
+   }
+
+   protected abstract String createAttributeKey(String attrName);
+}

Added: trunk/server/src/main/org/jboss/portal/server/impl/JBossInterceptorStackFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/JBossInterceptorStackFactory.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/JBossInterceptorStackFactory.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,108 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.impl.invocation;
+
+import org.jboss.portal.common.system.AbstractJBossService;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.InterceptorStack;
+
+import javax.management.ObjectName;
+import java.util.List;
+
+/**
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.10 $
+ */
+public class JBossInterceptorStackFactory extends AbstractJBossService implements InterceptorStackFactory
+{
+
+   /** . */
+   protected List interceptorNames;
+
+   protected InterceptorStack stack;
+
+   public List getInterceptorNames()
+   {
+      return interceptorNames;
+   }
+
+   public void setInterceptorNames(List interceptorNames)
+   {
+      this.interceptorNames = interceptorNames;
+   }
+
+   public InterceptorStack getInterceptorStack()
+   {
+      return stack;
+   }
+
+   /**
+    * Add's the supplied name to the list of interceptor names.
+    *
+    * @param name the intercptor's ObjectName.
+    * @throws Exception
+    */
+   public void addInterceptor(ObjectName name) throws Exception
+   {
+      interceptorNames.add(name);
+   }
+
+   /**
+    * Remove's the supplied name from the list of interceptor names.
+    *
+    * @param name the intercptor's ObjectName.
+    * @throws Exception
+    */
+   public void removeInterceptor(ObjectName name) throws Exception
+   {
+      interceptorNames.remove(name);
+   }
+
+   public void startService() throws Exception
+   {
+      rebuild();
+   }
+
+   /**
+    * Rebuild the interceptor stack.
+    */
+   public void rebuild() throws Exception
+   {
+      if (interceptorNames != null)
+      {
+         Interceptor[] interceptors = new Interceptor[interceptorNames.size()];
+         for (int i = 0; i < interceptorNames.size(); i++)
+         {
+            ObjectName name = (ObjectName)interceptorNames.get(i);
+            interceptors[i] = (Interceptor)server.getAttribute(name, "Interceptor");
+         }
+         stack = new JBossInterceptorStack(interceptors);
+      }
+   }
+
+   public void stopService()
+   {
+      this.stack = null;
+   }
+}

Added: trunk/server/src/main/org/jboss/portal/server/impl/NavigationalStateAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/NavigationalStateAttributeResolver.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/NavigationalStateAttributeResolver.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.impl;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NavigationalStateAttributeResolver extends AbstractSessionAttributeResolver
+{
+
+   public NavigationalStateAttributeResolver(HttpServletRequest req)
+   {
+      super(req);
+   }
+
+   protected String createAttributeKey(String attrName)
+   {
+      String attrKey = "portal.navigationalstate." + attrName;
+      return attrKey;
+   }
+}

Added: trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.impl;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PrincipalAttributeResolver extends AbstractSessionAttributeResolver
+{
+   public PrincipalAttributeResolver(HttpServletRequest req)
+   {
+      super(req);
+   }
+
+   protected String createAttributeKey(String attrName)
+   {
+      Principal principal = req.getUserPrincipal();
+      String attrKey = "portal.principal." + (principal != null ? principal.getName() : "") + "." + attrName;
+      return attrKey;
+   }
+}

Added: trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,74 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.impl;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RequestAttributeResolver implements AttributeResolver
+{
+
+   private HttpServletRequest req;
+
+   public RequestAttributeResolver(HttpServletRequest req)
+   {
+      if (req == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      this.req = req;
+   }
+
+   public Object getAttribute(String attrName) throws IllegalArgumentException
+   {
+      if (attrName == null)
+      {
+         throw new IllegalArgumentException();
+      }
+
+      //
+      return req.getAttribute(attrName);
+   }
+
+   public void setAttribute(String attrName, Object attrValue) throws IllegalArgumentException
+   {
+      if (attrName == null)
+      {
+         throw new IllegalArgumentException();
+      }
+
+      //
+      if (attrValue != null)
+      {
+         req.setAttribute(attrName, attrValue);
+      }
+      else
+      {
+         req.removeAttribute(attrName);
+      }
+   }
+}

Added: trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,138 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.impl;
+
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.server.servlet.PortalServlet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServerInvocationContextImpl extends AbstractInvocationContext implements ServerInvocationContext
+{
+
+   /** The client request. */
+   private final HttpServletRequest req;
+
+   /** The client response. */
+   private final HttpServletResponse resp;
+
+   /** The portal context path. */
+   private String portalContextPath;
+
+   /** The portal request path. */
+   private String portalRequestPath;
+
+   /** . */
+   private String mediaType;
+
+   /** The <String,Parameter>Map. */
+   private Map parameterMap;
+
+   /** The url context. */
+   private URLContext urlContext;
+
+   public ServerInvocationContextImpl(
+      HttpServletRequest req,
+      HttpServletResponse resp,
+      String portalRequestPath,
+      String portalContextPath,
+      Map parameterMap,
+      URLContext urlContext,
+      String mediaType)
+   {
+      if (req == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      if (resp == null)
+      {
+         throw new IllegalArgumentException();
+      }
+
+      //
+      this.req = req;
+      this.resp = resp;
+      this.portalRequestPath = portalRequestPath;
+      this.portalContextPath = portalContextPath;
+      this.parameterMap = parameterMap;
+      this.urlContext = urlContext;
+      this.mediaType = mediaType;
+
+      //
+      addResolver(ServerInvocation.REQUEST_SCOPE, new RequestAttributeResolver(req));
+      addResolver(ServerInvocation.SESSION_SCOPE, new SessionAttributeResolver(req));
+      addResolver(ServerInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(req));
+      addResolver(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, new NavigationalStateAttributeResolver(req));
+   }
+
+   public HttpServletRequest getClientRequest()
+   {
+      return req;
+   }
+
+   public HttpServletResponse getClientResponse()
+   {
+      return resp;
+   }
+
+   public String getMediaType()
+   {
+      return mediaType;
+   }
+
+   public URLContext getURLContext()
+   {
+      return urlContext;
+   }
+
+   public Map getParameterMap()
+   {
+      return parameterMap;
+   }
+
+   public String getPortalRequestPath()
+   {
+      return portalRequestPath;
+   }
+
+   public String getPortalContextPath()
+   {
+      return portalContextPath;
+   }
+
+   public String encodeURL(ServerURL url, URLContext context, URLFormat format)
+   {
+      PortalServlet.Buffer buffer = new PortalServlet.Buffer(req, resp, context, format);
+      return buffer.toString(url);
+   }
+}

Added: trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.server.impl;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SessionAttributeResolver extends AbstractSessionAttributeResolver
+{
+
+   public SessionAttributeResolver(HttpServletRequest req)
+   {
+      super(req);
+   }
+
+   protected String createAttributeKey(String attrName)
+   {
+      return attrName;
+   }
+}

Modified: trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,98 +23,34 @@
 
 import org.jboss.portal.common.invocation.InterceptorStack;
 import org.jboss.portal.common.invocation.Interceptor;
-import org.jboss.portal.common.system.AbstractJBossService;
 
-import javax.management.ObjectName;
-import java.util.List;
-
 /**
  *
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class JBossInterceptorStack extends AbstractJBossService implements InterceptorStack
+public class JBossInterceptorStack implements InterceptorStack
 {
 
    /** . */
    protected Interceptor[] interceptors;
 
-   /** . */
-   protected List interceptorNames;
-
    public JBossInterceptorStack(Interceptor[] interceptors)
    {
+      if (interceptors == null)
+      {
+         throw new IllegalArgumentException();
+      }
       this.interceptors = interceptors;
    }
 
-   public JBossInterceptorStack()
+   public int getLength()
    {
+      return interceptors.length;
    }
 
-   public List getInterceptorNames()
+   public Interceptor getInterceptor(int index) throws ArrayIndexOutOfBoundsException
    {
-      return interceptorNames;
+      return interceptors[index];
    }
-
-   public void setInterceptorNames(List interceptorNames)
-   {
-      this.interceptorNames = interceptorNames;
-   }
-
-   public Interceptor[] getInterceptors()
-   {
-      return interceptors;
-   }
-   /**
-    * Add's the supplied name to the list of interceptor names.
-    *
-    * @param name the intercptor's ObjectName.
-    * @throws Exception
-    */
-   public void addInterceptor(ObjectName name) throws Exception
-   {
-      interceptorNames.add(name);
-   }
-
-   /**
-    * Remove's the supplied name from the list of interceptor names.
-    *
-    * @param name the intercptor's ObjectName.
-    * @throws Exception
-    */
-   public void removeInterceptor(ObjectName name) throws Exception
-   {
-      interceptorNames.remove(name);
-   }
-
-   public void startService() throws Exception
-   {
-      rebuild();
-   }
-
-   /**
-    * Rebuild the interceptor stack.
-    */
-   public void rebuild() throws Exception
-   {
-      if (interceptorNames != null)
-      {
-         Interceptor[] interceptors = new Interceptor[interceptorNames.size()];
-         for (int i = 0; i < interceptorNames.size(); i++)
-         {
-            ObjectName name = (ObjectName)interceptorNames.get(i);
-            interceptors[i] = (Interceptor)server.getAttribute(name, "Interceptor");
-         }
-         this.interceptors = interceptors;
-      }
-      else
-      {
-         interceptors = new Interceptor[0];
-      }
-   }
-
-   public void stopService()
-   {
-      this.interceptors = null;
-   }
 }

Modified: trunk/server/src/main/org/jboss/portal/server/navigation/NavigationalStateContext.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/navigation/NavigationalStateContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/navigation/NavigationalStateContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,59 +21,14 @@
 */
 package org.jboss.portal.server.navigation;
 
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
+import org.jboss.portal.common.invocation.AttributeResolver;
 
 /**
- * The per request nagivational state context.
  *
+ *
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class NavigationalStateContext implements Serializable
+public interface NavigationalStateContext extends AttributeResolver
 {
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -1351638554294221803L;
-   /** . */
-   protected Map states = new HashMap();
-
-   /**
-    * Provide the navigational state for an id.
-    *
-    * @param id the id of the object we want the state
-    * @return the corresponding navigational state
-    * @throws IllegalArgumentException if the id is null
-    */
-   public Object getNavigationalState(String id) throws IllegalArgumentException
-   {
-      if (id == null)
-      {
-         throw new IllegalArgumentException("No null id");
-      }
-      return states.get(id);
-   }
-
-   /**
-    * Store a navigational state in the context.
-    *
-    * @param id the id
-    * @param state the new state or null if the state must be removed
-    * @throws IllegalArgumentException if the id is null
-    */
-   public void setNavigationalState(String id, Object state) throws IllegalArgumentException
-   {
-      if (id == null)
-      {
-         throw new IllegalArgumentException("No null id");
-      }
-      if (state != null)
-      {
-         states.put(id, state);
-      }
-      else
-      {
-         states.remove(id);
-      }
-   }
 }

Modified: trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -24,26 +24,24 @@
 import org.apache.log4j.Logger;
 import org.jboss.mx.util.MBeanProxy;
 import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.portal.common.invocation.InterceptorStack;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
 import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.common.util.Exceptions;
 import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.PortalConstants;
 import org.jboss.portal.server.Server;
 import org.jboss.portal.server.ServerException;
 import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerRequestContext;
 import org.jboss.portal.server.ServerResponse;
-import org.jboss.portal.server.ServerResponseContext;
 import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.server.PortalConstants;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.server.request.RequestParameter;
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.server.request.RequestParameter;
 
 import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -51,12 +49,12 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
 import java.util.StringTokenizer;
-import java.nio.charset.Charset;
 
 /**
  * The main servlet of the portal. This servlet must be properly configured with the servlet mapping style it is
@@ -87,22 +85,15 @@
    private Server server;
 
    /** The interceptor stack. */
-   private InterceptorStack interceptorStack;
+   private InterceptorStackFactory interceptorStack;
 
-   /** The controller for the servlet. */
-   private RequestController controller;
-
    /** Are we or not the default servlet ? */
    private boolean asDefaultServlet;
 
-   /** The request controller object name. */
-   private ObjectName controllerName;
-
    /** Configure the as default servlet. */
    public void init() throws ServletException
    {
       asDefaultServlet = getAsDefaultServletInitValue();
-      controllerName = getControllerNameInitValue();
    }
 
    /**
@@ -126,14 +117,14 @@
       return server;
    }
 
-   protected final InterceptorStack getInterceptorStack()
+   protected final InterceptorStackFactory getInterceptorStackFactory()
    {
       if (interceptorStack == null)
       {
          try
          {
             MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
-            interceptorStack = (InterceptorStack)MBeanProxy.get(InterceptorStack.class, new ObjectName("portal:service=InterceptorStack,type=Server"), mbeanServer);
+            interceptorStack = (InterceptorStackFactory)MBeanProxy.get(InterceptorStackFactory.class, new ObjectName("portal:service=InterceptorStackFactory,type=Server"), mbeanServer);
          }
          catch (Exception e)
          {
@@ -144,24 +135,6 @@
       return interceptorStack;
    }
 
-   protected final RequestController getController()
-   {
-      if (controller == null)
-      {
-         try
-         {
-            MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
-            controller = (RequestController)MBeanProxy.get(RequestController.class, controllerName, mbeanServer);
-         }
-         catch (Exception e)
-         {
-            log.error("Cannot get controller", e);
-            throw new IllegalStateException("Cannot get controller");
-         }
-      }
-      return controller;
-   }
-
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
       process(req, resp, false);
@@ -270,28 +243,34 @@
 
       //
       Server server = getServer();
-      RequestController controller = getController();
 
       //
-      ServerRequestContext requestContext = new ServerRequestContextImpl(req, portalRequestPath, portalContextPath, parameterMap, urlContext, mediaType);
-      ServerRequest request = new ServerRequest(requestContext);
+      ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
+         req,
+         resp,
+         portalRequestPath,
+         portalContextPath,
+         parameterMap,
+         urlContext,
+         mediaType);
+
+      //
+      ServerRequest request = new ServerRequest();
       request.setServer(server);
 
       //
-      ServerResponseContext responseContext = new ServerResponseContextImpl(req, resp);
-      ServerResponse response = new ServerResponse(request, responseContext);
+      ServerResponse response = new ServerResponse(request, invocationCtx);
 
       //
-      ServerInvocation invocation = new ServerInvocation();
+      ServerInvocation invocation = new ServerInvocation(invocationCtx);
       invocation.setRequest(request);
       invocation.setResponse(response);
-      invocation.setController(controller);
 
       //
       try
       {
-         InterceptorStack stack = getInterceptorStack();
-         invocation.invoke(stack.getInterceptors());
+         InterceptorStackFactory stack = getInterceptorStackFactory();
+         invocation.invoke(stack.getInterceptorStack());
       }
       catch (ServerException e)
       {
@@ -314,25 +293,6 @@
    }
 
    /**
-    * Return the object name of the controller used by this portal servlet. This implementation get the value from an
-    * init parameter of the servlet called <b>controllerName</b>
-    */
-   protected ObjectName getControllerNameInitValue() throws ServletException
-   {
-      ServletConfig config = getServletConfig();
-      String value = config.getInitParameter("controllerName");
-      try
-      {
-         return new ObjectName(value);
-      }
-      catch (MalformedObjectNameException e)
-      {
-         log.debug("Controller object name is not well formed " + value, e);
-         throw new ServletException(e);
-      }
-   }
-
-   /**
     * Return the value for the servlet mapping. This implementation get the value from an init parameter of the servlet
     * called <b>asDefaultServlet</b>
     */
@@ -357,85 +317,6 @@
       }
    }
 
-   public class ServerRequestContextImpl implements ServerRequestContext
-   {
-
-      private HttpServletRequest req;
-      private String portalRequestPath;
-      private String portalContextPath;
-      private String mediaType;
-
-      /** The <String,Parameter>Map. */
-      private Map parameterMap;
-
-      /** The url context. */
-      private URLContext urlContext;
-
-      public ServerRequestContextImpl(HttpServletRequest req, String requestPath, String contextPath, Map parameterMap, URLContext urlContext, String mediaType)
-      {
-         this.req = req;
-         this.portalRequestPath = requestPath;
-         this.portalContextPath = contextPath;
-         this.mediaType = mediaType;
-         this.parameterMap = parameterMap;
-         this.urlContext = urlContext;
-      }
-
-      public String getMediaType()
-      {
-         return mediaType;
-      }
-
-      public URLContext getURLContext()
-      {
-         return urlContext;
-      }
-
-      public Map getParameterMap()
-      {
-         return parameterMap;
-      }
-
-      public HttpServletRequest getClientRequest()
-      {
-         return req;
-      }
-
-      public String getPortalRequestPath()
-      {
-         return portalRequestPath;
-      }
-
-      public String getPortalContextPath()
-      {
-         return portalContextPath;
-      }
-   }
-
-   public class ServerResponseContextImpl implements ServerResponseContext
-   {
-
-      private HttpServletRequest req;
-      private HttpServletResponse resp;
-
-      public ServerResponseContextImpl(HttpServletRequest req, HttpServletResponse resp)
-      {
-         this.req = req;
-         this.resp = resp;
-      }
-
-      public HttpServletResponse getClientResponse()
-      {
-         return resp;
-      }
-
-      public String encodeURL(ServerURL url, URLContext context, URLFormat format)
-      {
-         Buffer buffer = new Buffer(req, resp, context, format);
-         return buffer.toString(url);
-      }
-   }
-
    public static class Buffer
    {
 

Modified: trunk/server/src/main/org/jboss/portal/test/server/charset/GetTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/charset/GetTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/charset/GetTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,16 +21,14 @@
 */
 package org.jboss.portal.test.server.charset;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.server.parameters.Utils;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.AbstractServerURL;
-import org.jboss.portal.server.ServerRequestContext;
-import org.jboss.portal.server.request.RequestParameter;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokeGetResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -56,7 +54,7 @@
          {
             public void run() throws Exception
             {
-               ServerRequestContext context = invocation.getRequest().getContext();
+               ServerInvocationContext context = invocation.getServerContext();
                HttpServletRequest req = context.getClientRequest();
                assertNull(context.getMediaType());
                assertNull(req.getCharacterEncoding());

Modified: trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataNoCharsetTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataNoCharsetTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataNoCharsetTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.test.server.charset;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.AbstractServerURL;
 import org.jboss.portal.server.PortalConstants;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokePostResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -59,7 +59,7 @@
          {
             public void run() throws Exception
             {
-               ServerRequestContext context = invocation.getRequest().getContext();
+               ServerInvocationContext context = invocation.getServerContext();
                HttpServletRequest req = context.getClientRequest();
                assertEquals(PortalConstants.MULTIPART_FORM_DATA, context.getMediaType());
                assertNull(req.getCharacterEncoding());

Modified: trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataUTF8Test.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataUTF8Test.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataUTF8Test.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.test.server.charset;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.AbstractServerURL;
 import org.jboss.portal.server.PortalConstants;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokePostResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -59,7 +59,7 @@
          {
             public void run() throws Exception
             {
-               ServerRequestContext context = invocation.getRequest().getContext();
+               ServerInvocationContext context = invocation.getServerContext();
                HttpServletRequest req = context.getClientRequest();
                assertEquals(PortalConstants.MULTIPART_FORM_DATA, context.getMediaType());
                // assertEquals(PortalConstants.UTF_8.name(), req.getCharacterEncoding());

Modified: trunk/server/src/main/org/jboss/portal/test/server/charset/PostTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/charset/PostTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/charset/PostTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,14 @@
 */
 package org.jboss.portal.test.server.charset;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.AbstractServerURL;
-import org.jboss.portal.server.PortalConstants;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokePostResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -58,7 +57,7 @@
          {
             public void run() throws Exception
             {
-               ServerRequestContext context = invocation.getRequest().getContext();
+               ServerInvocationContext context = invocation.getServerContext();
                HttpServletRequest req = context.getClientRequest();
                assertNull(context.getMediaType());
                assertNull(req.getCharacterEncoding());

Modified: trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedNoCharsetTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedNoCharsetTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedNoCharsetTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.test.server.charset;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.PortalConstants;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.test.framework.container.TestCaseContext;
 import org.jboss.portal.test.framework.container.result.AssertResult;
 import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.AbstractServerURL;
-import org.jboss.portal.server.PortalConstants;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -59,7 +59,7 @@
          {
             public void run() throws Exception
             {
-               ServerRequestContext context = invocation.getRequest().getContext();
+               ServerInvocationContext context = invocation.getServerContext();
                HttpServletRequest req = context.getClientRequest();
                assertEquals(PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED, context.getMediaType());
                assertEquals(PortalConstants.UTF_8.name(), req.getCharacterEncoding());

Modified: trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedUTF8Test.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedUTF8Test.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedUTF8Test.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.test.server.charset;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.AbstractServerURL;
 import org.jboss.portal.server.PortalConstants;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokePostResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -59,7 +59,7 @@
          {
             public void run() throws Exception
             {
-               ServerRequestContext context = invocation.getRequest().getContext();
+               ServerInvocationContext context = invocation.getServerContext();
                HttpServletRequest req = context.getClientRequest();
                assertEquals(PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED, context.getMediaType());
                assertEquals(PortalConstants.UTF_8.name(), req.getCharacterEncoding());

Modified: trunk/server/src/main/org/jboss/portal/test/server/parameters/GetTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/parameters/GetTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/parameters/GetTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,14 +21,15 @@
 */
 package org.jboss.portal.test.server.parameters;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.server.AbstractServerURL;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.request.RequestParameter;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokeGetResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -56,7 +57,8 @@
          {
             public void run() throws Exception
             {
-               RequestParameter a = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("a");
+               ServerInvocationContext context = invocation.getServerContext();
+               RequestParameter a = (RequestParameter)context.getParameterMap().get("a");
                assertNotNull(a);
                assertEquals("a", a.getName());
                assertEquals(1, a.size());
@@ -67,7 +69,7 @@
                assertEquals(1, a.getThreshold());
 
                //
-               RequestParameter c = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("c");
+               RequestParameter c = (RequestParameter)context.getParameterMap().get("c");
                assertNotNull(c);
                assertEquals("c", c.getName());
                assertEquals(2, c.size());
@@ -80,7 +82,7 @@
                assertEquals(2, c.getThreshold());
 
                //
-               RequestParameter f = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("encoding");
+               RequestParameter f = (RequestParameter)context.getParameterMap().get("encoding");
                assertNotNull(f);
                assertEquals("encoding", f.getName());
                assertEquals(1, f.size());

Modified: trunk/server/src/main/org/jboss/portal/test/server/parameters/PostApplicationXWWWFormURLEncodedTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/parameters/PostApplicationXWWWFormURLEncodedTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/parameters/PostApplicationXWWWFormURLEncodedTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,14 +21,15 @@
 */
 package org.jboss.portal.test.server.parameters;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.server.AbstractServerURL;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.request.RequestParameter;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokePostResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -77,7 +78,8 @@
          {
             public void run() throws Exception
             {
-               RequestParameter a = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("a");
+               ServerInvocationContext context = invocation.getServerContext();
+               RequestParameter a = (RequestParameter)context.getParameterMap().get("a");
                assertNotNull(a);
                assertEquals("a", a.getName());
                assertEquals(1, a.size());
@@ -88,7 +90,7 @@
                assertEquals(1, a.getThreshold());
 
                //
-               RequestParameter c = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("c");
+               RequestParameter c = (RequestParameter)context.getParameterMap().get("c");
                assertNotNull(c);
                assertEquals("c", c.getName());
                assertEquals(2, c.size());
@@ -101,7 +103,7 @@
                assertEquals(2, c.getThreshold());
 
                //
-               RequestParameter f = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("f");
+               RequestParameter f = (RequestParameter)context.getParameterMap().get("f");
                assertNotNull(f);
                assertEquals("f", f.getName());
                assertEquals(2, f.size());
@@ -114,7 +116,7 @@
                assertEquals(1, f.getThreshold());
 
                //
-               RequestParameter h = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("h");
+               RequestParameter h = (RequestParameter)context.getParameterMap().get("h");
                assertNotNull(h);
                assertEquals("h", h.getName());
                assertEquals(4, h.size());
@@ -131,7 +133,7 @@
                assertEquals(2, h.getThreshold());
 
                //
-               RequestParameter encoding1 = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("encoding_1");
+               RequestParameter encoding1 = (RequestParameter)context.getParameterMap().get("encoding_1");
                assertNotNull(encoding1);
                assertEquals("encoding_1", encoding1.getName());
                assertEquals(2, encoding1.size());
@@ -143,7 +145,7 @@
                assertTrue(encoding1.isFromBody(1));
 
                //
-               RequestParameter encoding2 = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("encoding_2");
+               RequestParameter encoding2 = (RequestParameter)context.getParameterMap().get("encoding_2");
                assertNotNull(encoding2);
                assertEquals("encoding_2", encoding2.getName());
                assertEquals(2, encoding2.size());
@@ -155,7 +157,7 @@
                assertTrue(encoding2.isFromBody(1));
 
                //
-               RequestParameter k = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("k");
+               RequestParameter k = (RequestParameter)context.getParameterMap().get("k");
                assertNotNull(k);
                assertEquals("k", k.getName());
                assertEquals(1, k.size());
@@ -166,7 +168,7 @@
                assertEquals(0, k.getThreshold());
 
                //
-               RequestParameter m = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("m");
+               RequestParameter m = (RequestParameter)context.getParameterMap().get("m");
                assertNotNull(m);
                assertEquals("m", m.getName());
                assertEquals(2, m.size());

Modified: trunk/server/src/main/org/jboss/portal/test/server/parameters/PostMultipartFormDataTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/parameters/PostMultipartFormDataTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/parameters/PostMultipartFormDataTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,14 +21,15 @@
 */
 package org.jboss.portal.test.server.parameters;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokePostResult;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.server.AbstractServerURL;
 import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.request.RequestParameter;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokePostResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -68,7 +69,8 @@
          {
             public void run() throws Exception
             {
-               RequestParameter a = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("a");
+               ServerInvocationContext context = invocation.getServerContext();
+               RequestParameter a = (RequestParameter)context.getParameterMap().get("a");
                assertNotNull(a);
                assertEquals("a", a.getName());
                assertEquals(1, a.size());
@@ -79,7 +81,7 @@
                assertEquals(1, a.getThreshold());
 
                //
-               RequestParameter c = (RequestParameter)invocation.getRequest().getContext().getParameterMap().get("c");
+               RequestParameter c = (RequestParameter)context.getParameterMap().get("c");
                assertNotNull(c);
                assertEquals("c", c.getName());
                assertEquals(2, c.size());

Modified: trunk/server/src/main/org/jboss/portal/test/server/servlet/DefaultServletMappingTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/servlet/DefaultServletMappingTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/servlet/DefaultServletMappingTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.test.server.servlet;
 
-import org.jboss.portal.test.server.AbstractTest;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.test.framework.container.TestCaseContext;
 import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.FailureResult;
+import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.FailureResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.test.server.AbstractTest;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -43,7 +43,7 @@
    public Result execute(ServerInvocation invocation)
    {
       ServerRequest req = invocation.getRequest();
-      final ServerRequestContext ctx = req.getContext();
+      final ServerInvocationContext ctx = invocation.getServerContext();
       switch(TestCaseContext.getCurrentRequestCount())
       {
          case 0:

Modified: trunk/server/src/main/org/jboss/portal/test/server/servlet/PathMappingTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/servlet/PathMappingTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/servlet/PathMappingTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.test.server.servlet;
 
-import org.jboss.portal.test.server.AbstractTest;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.test.framework.container.TestCaseContext;
 import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.FailureResult;
+import org.jboss.portal.test.framework.container.result.InvokeGetResult;
 import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.FailureResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.test.server.AbstractTest;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -43,7 +43,7 @@
    public Result execute(ServerInvocation invocation)
    {
       ServerRequest req = invocation.getRequest();
-      final ServerRequestContext ctx = req.getContext();
+      final ServerInvocationContext ctx = invocation.getServerContext();
       switch(TestCaseContext.getCurrentRequestCount())
       {
          case 0:

Modified: trunk/server/src/main/org/jboss/portal/test/server/servlet/RootPathMappingTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/servlet/RootPathMappingTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/servlet/RootPathMappingTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,15 +21,15 @@
 */
 package org.jboss.portal.test.server.servlet;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.test.framework.container.TestCaseContext;
 import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.FailureResult;
 import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.FailureResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerRequestContext;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -43,7 +43,7 @@
    public Result execute(ServerInvocation invocation)
    {
       ServerRequest req = invocation.getRequest();
-      final ServerRequestContext ctx = req.getContext();
+      final ServerInvocationContext ctx = invocation.getServerContext();
       switch(TestCaseContext.getCurrentRequestCount())
       {
          case 0:

Modified: trunk/server/src/main/org/jboss/portal/test/server/session/SessionTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/session/SessionTest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/main/org/jboss/portal/test/server/session/SessionTest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,21 +21,22 @@
 */
 package org.jboss.portal.test.server.session;
 
-import org.jboss.portal.test.server.AbstractTest;
-import org.jboss.portal.test.framework.container.result.Result;
-import org.jboss.portal.test.framework.container.result.AssertResult;
-import org.jboss.portal.test.framework.container.result.InvokeGetResult;
-import org.jboss.portal.test.framework.container.result.FailureResult;
-import org.jboss.portal.test.framework.container.TestCaseContext;
 import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
 import org.jboss.portal.server.servlet.ProxyRequest;
 import org.jboss.portal.server.servlet.ProxyResponse;
+import org.jboss.portal.test.framework.container.TestCaseContext;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.FailureResult;
+import org.jboss.portal.test.framework.container.result.InvokeGetResult;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.server.AbstractTest;
 
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletContext;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
 import java.io.IOException;
 
 /**
@@ -50,8 +51,9 @@
    public Result execute(ServerInvocation invocation)
    {
 
-      HttpServletRequest hreq = invocation.getRequest().getContext().getClientRequest();
-      HttpServletResponse hresp = invocation.getResponse().getContext().getClientResponse();
+      ServerInvocationContext context = invocation.getServerContext();
+      HttpServletRequest hreq = context.getClientRequest();
+      HttpServletResponse hresp = context.getClientResponse();
 
       ServletContext fromctx = hreq.getSession().getServletContext();
       ServletContext toctx = fromctx.getContext("/test-session");

Modified: trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,12 +23,21 @@
 
    <!-- Server stack -->
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Server"
+      code="org.jboss.portal.server.aspects.server.ControllerInterceptor"
+      name="portal:service=Interceptor,type=Controller"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
+      <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends>
+   </mbean>
+   <mbean
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Server"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+      <xmbean/>
       <depends-list optional-attribute-name="InterceptorNames">
+         <depends-list-element>portal:service=Interceptor,type=Controller</depends-list-element>
       </depends-list>
    </mbean>
 

Modified: trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -10,7 +10,6 @@
       <attribute name="ConfigLocation">conf/config.xml</attribute>
    </mbean>
 
-
    <!-- Server -->
    <mbean
       code="org.jboss.portal.server.impl.ServerImpl"
@@ -23,12 +22,21 @@
 
    <!-- Server stack -->
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Server"
+      code="org.jboss.portal.server.aspects.server.ControllerInterceptor"
+      name="portal:service=Interceptor,type=Controller"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
+      <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends>
+   </mbean>
+   <mbean
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Server"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+      <xmbean/>
       <depends-list optional-attribute-name="InterceptorNames">
+         <depends-list-element>portal:service=Interceptor,type=Controller</depends-list-element>
       </depends-list>
    </mbean>
 

Modified: trunk/server/src/resources/test/test-servlet-defaultservletmapping-war/WEB-INF/web.xml
===================================================================
--- trunk/server/src/resources/test/test-servlet-defaultservletmapping-war/WEB-INF/web.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/resources/test/test-servlet-defaultservletmapping-war/WEB-INF/web.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -12,11 +12,6 @@
          <param-value>true</param-value>
          <description>The servlet needs to know wether it is set as a default servlet or not</description>
       </init-param>
-      <init-param>
-         <param-name>controllerName</param-name>
-         <param-value>portal:controller=Request</param-value>
-         <description>The request controller for the portal servlet</description>
-      </init-param>
       <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>

Modified: trunk/server/src/resources/test/test-servlet-pathmapping-war/WEB-INF/web.xml
===================================================================
--- trunk/server/src/resources/test/test-servlet-pathmapping-war/WEB-INF/web.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/resources/test/test-servlet-pathmapping-war/WEB-INF/web.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -12,11 +12,6 @@
          <param-value>false</param-value>
          <description>The servlet needs to know wether it is set as a default servlet or not</description>
       </init-param>
-      <init-param>
-         <param-name>controllerName</param-name>
-         <param-value>portal:controller=Request</param-value>
-         <description>The request controller for the portal servlet</description>
-      </init-param>
       <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>

Modified: trunk/server/src/resources/test/test-servlet-rootpathmapping-war/WEB-INF/web.xml
===================================================================
--- trunk/server/src/resources/test/test-servlet-rootpathmapping-war/WEB-INF/web.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/resources/test/test-servlet-rootpathmapping-war/WEB-INF/web.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -12,11 +12,6 @@
          <param-value>false</param-value>
          <description>The servlet needs to know wether it is set as a default servlet or not</description>
       </init-param>
-      <init-param>
-         <param-name>controllerName</param-name>
-         <param-value>portal:controller=Request</param-value>
-         <description>The request controller for the portal servlet</description>
-      </init-param>
       <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>

Modified: trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,14 +21,26 @@
       <depends optional-attribute-name="Config" proxy-type="attribute">portal:service=ServerConfig</depends>
    </mbean>
 
+
    <!-- Server stack -->
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Server"
+      code="org.jboss.portal.server.aspects.server.ControllerInterceptor"
+      name="portal:service=Interceptor,type=Controller"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
+      <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Server"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+      <xmbean/>
+      <depends-list optional-attribute-name="InterceptorNames">
+         <depends-list-element>portal:service=Interceptor,type=Controller</depends-list-element>
+      </depends-list>
+   </mbean>
 
    <!--  -->
    <mbean

Modified: trunk/server/src/resources/test/test-session-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/test/test-session-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/server/src/resources/test/test-session-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,12 +23,23 @@
 
    <!-- Server stack -->
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Server"
+      code="org.jboss.portal.server.aspects.server.ControllerInterceptor"
+      name="portal:service=Interceptor,type=Controller"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
+      <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Server"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
+      <xmbean/>
+      <depends-list optional-attribute-name="InterceptorNames">
+         <depends-list-element>portal:service=Interceptor,type=Controller</depends-list-element>
+      </depends-list>
+   </mbean>
 
    <!--  -->
    <mbean

Modified: trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -43,9 +43,6 @@
    /** . */
    private static Logger log = Logger.getLogger(AssertResult.class);
 
-   /** The number of test ran. */
-   private int count;
-
    /** The throwable that failed this assertion. */
    private Throwable throwable;
 
@@ -56,7 +53,6 @@
    public AssertResult(Throwable t)
    {
       throwable = t;
-      count++;
    }
 
    public static AssertResult run(Test test) throws IllegalArgumentException, IllegalStateException
@@ -99,10 +95,6 @@
             AssertResult.log.error("Error during test", e);
             throwable = e;
          }
-         finally
-         {
-            count++;
-         }
       }
       else
       {
@@ -116,14 +108,6 @@
    }
 
    /**
-    * Return how many times the execute method has been successfully invoked.
-    */
-   public int getCount()
-   {
-      return count;
-   }
-
-   /**
     * Return the recorded throwable or null if nothing has been recorded.
     */
    public Throwable getThrowable()

Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,14 +23,12 @@
 
 import org.jboss.portal.Mode;
 import org.jboss.portal.WindowState;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerRequestContext;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.portlet.Properties;
+import org.jboss.portal.server.ServerRequest;
 import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.ThemeService;
 import org.jboss.portal.theme.RuntimeContext;
+import org.jboss.portal.theme.ThemeService;
 import org.jboss.portal.theme.deployment.jboss.PortalLayoutMetaDataFactory;
 import org.jboss.portal.theme.deployment.jboss.RenderSetMetaDataFactory;
 import org.jboss.portal.theme.impl.LayoutServiceImpl;
@@ -63,10 +61,10 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
-import java.io.StringReader;
-import java.io.Reader;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.Principal;
@@ -199,7 +197,7 @@
       return (PortalLayoutMetaData)layoutMDList.get(0);
    }
 
-   public static PageResult createPageResult(NavigationalStateContext navCtx, String pageName,
+   public static PageResult createPageResult(AttributeResolver navCtx, String pageName,
                                              Map pageProperties, Map portalProperties, WindowContext[] windows)
    {
       ModifiablePageResult pageResult = new ModifiablePageResult(navCtx, pageName, pageProperties, portalProperties);
@@ -213,39 +211,7 @@
    public static ServerRequest createServerRequest()
    {
       final HttpServletRequest clientRequest = new TestHttpServletRequest();
-      ServerRequestContext reqContext = new ServerRequestContext()
-      {
-         public HttpServletRequest getClientRequest()
-         {
-            return clientRequest;
-         }
-
-         public String getMediaType()
-         {
-            throw new UnsupportedOperationException();
-         }
-
-         public Map getParameterMap()
-         {
-            throw new UnsupportedOperationException();
-         }
-
-         public URLContext getURLContext()
-         {
-            throw new UnsupportedOperationException();
-         }
-
-         public String getPortalRequestPath()
-         {
-            return "/portalRequestPath";
-         }
-
-         public String getPortalContextPath()
-         {
-            return "/portalContextPath";
-         }
-      };
-      return new ServerRequest(reqContext);
+      return new ServerRequest();
    }
 
    public static class TestContext implements ServletContext

Modified: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -4,8 +4,8 @@
 import org.jboss.portal.Mode;
 import org.jboss.portal.WindowState;
 import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.server.util.HTTPStreamInfo;
 import org.jboss.portal.test.theme.TestHelper;
 import org.jboss.portal.theme.LayoutService;
@@ -45,7 +45,7 @@
    private PageService pageService;
    private HTTPStreamInfo streamInfo;
    private ServerRequest serverRequest;
-   private NavigationalStateContext navCtx;
+   private AttributeResolver navCtx;
    private Map portalProps = new HashMap();
    private Map pageProps = new HashMap();
 //   private ServerRequest request;
@@ -60,8 +60,20 @@
       WindowNavigationalState windowNavigationalState = TestHelper.createWindowNavigationalState();
       windowContext = new WindowContext(windowName, windowID, regionName, order);
       markupResult = TestHelper.createWindowResult("title", "content");
-      navCtx = new NavigationalStateContext();
-      navCtx.setNavigationalState(windowID + "_window", windowNavigationalState);
+
+      navCtx = new AttributeResolver()
+      {
+         public Object getAttribute(String attrName) throws IllegalArgumentException
+         {
+            throw new UnsupportedOperationException();
+         }
+         public void setAttribute(String attrName, Object attrValue) throws IllegalArgumentException
+         {
+            throw new UnsupportedOperationException();
+         }
+      };
+
+      navCtx.setAttribute(windowID + "_window", windowNavigationalState);
       markupResult.setNavigationalStateContext(navCtx);
       markupResult.addWindowContext(windowContext);
       streamInfo = new HTTPStreamInfo(MediaType.HTML, "utf-8");

Modified: trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,8 @@
 */
 package org.jboss.portal.theme;
 
+import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerResponse;
 import org.jboss.portal.server.util.HTTPStreamInfo;
 import org.jboss.portal.theme.render.MarkupResult;
 import org.jboss.portal.theme.render.RenderContext;
@@ -53,13 +53,12 @@
    /**
     * Assemble the fragments created by the portlet render process into a response and send it back to the client (write it to the response)
     *
-    * @param request      the current server request
-    * @param response     the current server response
+    * @param invocation
     * @param markupResult the result containing the information about what was rendered and what the resulting markup fragments are
     * @throws ServletException
     * @throws IOException
     */
-   public abstract void assembleResponse(ServerRequest request, ServerResponse response, MarkupResult markupResult)
+   public abstract void assembleResponse(ServerInvocation invocation, MarkupResult markupResult)
       throws ServletException, IOException;
 
    /**

Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,7 +1,6 @@
 package org.jboss.portal.theme.impl;
 
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerResponse;
+import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.theme.LayoutDispatcher;
 import org.jboss.portal.theme.PortalLayout;
 import org.jboss.portal.theme.render.MarkupResult;
@@ -22,14 +21,14 @@
 public final class JSPLayout extends PortalLayout
 {
    /**
-    * @see PortalLayout#assembleResponse(ServerRequest, ServerResponse, MarkupResult)
+    * @see PortalLayout#assembleResponse(org.jboss.portal.server.ServerInvocation,org.jboss.portal.theme.render.MarkupResult)
     */
-   public void assembleResponse(ServerRequest request, ServerResponse response, MarkupResult markupResult)
+   public void assembleResponse(ServerInvocation invocation, MarkupResult markupResult)
       throws ServletException, IOException
    {
-      HttpServletRequest httpRequest = request.getContext().getClientRequest();
-      HttpServletResponse httpResponse = response.getContext().getClientResponse();
-      RenderContext renderCtx = getRenderContext(response.getStreamInfo(), request, markupResult);
+      HttpServletRequest httpRequest = invocation.getServerContext().getClientRequest();
+      HttpServletResponse httpResponse = invocation.getServerContext().getClientResponse();
+      RenderContext renderCtx = getRenderContext(invocation.getResponse().getStreamInfo(), invocation.getRequest(), markupResult);
       LayoutDispatcher dispatcher = new LayoutDispatcher(renderCtx, httpRequest, httpResponse, markupResult);
       dispatcher.include();
    }

Modified: trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,8 @@
 */
 package org.jboss.portal.theme.page;
 
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.render.ModifiableMarkupResult;
+import org.jboss.portal.common.invocation.AttributeResolver;
 
 import java.util.Map;
 
@@ -33,7 +33,7 @@
  */
 public final class ModifiablePageResult extends PageResult implements ModifiableMarkupResult
 {
-   public ModifiablePageResult(NavigationalStateContext navCtx, String pageName, Map pageProperties, Map portalProperties)
+   public ModifiablePageResult(AttributeResolver navCtx, String pageName, Map pageProperties, Map portalProperties)
    {
       super(navCtx, pageName, pageProperties, portalProperties);
    }

Modified: trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,8 @@
 */
 package org.jboss.portal.theme.page;
 
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.render.ModifiableMarkupResult;
+import org.jboss.portal.common.invocation.AttributeResolver;
 
 import java.util.Map;
 
@@ -32,7 +32,7 @@
  */
 public class ModifiableRegionResult extends RegionResult implements ModifiableMarkupResult
 {
-   public ModifiableRegionResult(NavigationalStateContext navCtx, String pageName,
+   public ModifiableRegionResult(AttributeResolver navCtx, String pageName,
                                  Region region, Map pageProperties, Map portalProperties)
    {
       super(navCtx, pageName, region, pageProperties, portalProperties);

Modified: trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,9 +21,9 @@
 */
 package org.jboss.portal.theme.page;
 
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.portlet.Properties;
 import org.jboss.portal.theme.render.ModifiableMarkupResult;
+import org.jboss.portal.common.invocation.AttributeResolver;
 
 import java.util.Map;
 
@@ -71,7 +71,7 @@
       throw new UnsupportedOperationException();
    }
 
-   public void setNavigationalStateContext(NavigationalStateContext navCtx)
+   public void setNavigationalStateContext(AttributeResolver navCtx)
    {
       this.navigationalStateContext = navCtx;
    }

Modified: trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,8 @@
 */
 package org.jboss.portal.theme.page;
 
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.render.MarkupResult;
+import org.jboss.portal.common.invocation.AttributeResolver;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -38,7 +38,7 @@
 {
    protected final Map portletRegions;
 
-   public PageResult(NavigationalStateContext navCtx, String pageName, Map pageProperties, Map portalProperties)
+   public PageResult(AttributeResolver navCtx, String pageName, Map pageProperties, Map portalProperties)
    {
       super(navCtx, pageName, pageProperties, portalProperties);
       portletRegions = new HashMap(5);

Modified: trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -21,8 +21,8 @@
 */
 package org.jboss.portal.theme.page;
 
-import org.jboss.portal.server.navigation.NavigationalStateContext;
 import org.jboss.portal.theme.render.MarkupResult;
+import org.jboss.portal.common.invocation.AttributeResolver;
 
 import java.util.Map;
 
@@ -34,7 +34,7 @@
 {
    protected final Region region;
 
-   public RegionResult(NavigationalStateContext navCtx, String pageName, Region region, Map pageProperties, Map portalProperties)
+   public RegionResult(AttributeResolver navCtx, String pageName, Region region, Map pageProperties, Map portalProperties)
    {
       super(navCtx, pageName, pageProperties, portalProperties);
       this.region = region;

Modified: trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -23,7 +23,7 @@
 
 import org.jboss.portal.Mode;
 import org.jboss.portal.WindowState;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.theme.navigation.WindowNavigationalState;
 import org.jboss.portal.theme.page.WindowContext;
 import org.jboss.portal.theme.page.WindowResult;
@@ -46,7 +46,7 @@
    protected String pageName;
    protected Map portalProperties;
    protected Map pageProperties;
-   protected NavigationalStateContext navigationalStateContext;
+   protected AttributeResolver navigationalStateContext;
    protected String layoutURI;
    protected String layoutState;
    protected PortalRenderSet renderSet;
@@ -56,7 +56,7 @@
       this(null, null, null, null);
    }
 
-   public MarkupResult(NavigationalStateContext navCtx, String pageName, Map pageProperties, Map portalProperties)
+   public MarkupResult(AttributeResolver navCtx, String pageName, Map pageProperties, Map portalProperties)
    {
       this.pageName = pageName;
       this.pageProperties = pageProperties == null ? new HashMap() : pageProperties;
@@ -178,7 +178,6 @@
     * @param windowId the identifier of the window on the page
     * @return the window state of the provided window
     * @throws IllegalStateException if no navigational state context was provided for this markup result
-    * @see org.jboss.portal.portlet.WindowState
     * @see WindowNavigationalState
     */
    public WindowState getWindowState(String windowId)
@@ -187,7 +186,7 @@
       {
          throw new IllegalStateException("No navigational state context available");
       }
-      WindowNavigationalState navState = (WindowNavigationalState)navigationalStateContext.getNavigationalState(windowId + "_window");
+      WindowNavigationalState navState = (WindowNavigationalState)navigationalStateContext.getAttribute(windowId + "_window");
       return navState.getWindowState();
    }
 
@@ -206,7 +205,7 @@
       {
          throw new IllegalStateException("No navigational state context available");
       }
-      WindowNavigationalState navState = (WindowNavigationalState)navigationalStateContext.getNavigationalState(windowId + "_window");
+      WindowNavigationalState navState = (WindowNavigationalState)navigationalStateContext.getAttribute(windowId + "_window");
       return navState.getMode();
    }
 }

Modified: trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -25,7 +25,7 @@
 import org.jboss.portal.Mode;
 import org.jboss.portal.WindowState;
 import org.jboss.portal.common.MediaType;
-import org.jboss.portal.server.navigation.NavigationalStateContext;
+import org.jboss.portal.common.invocation.AttributeResolver;
 import org.jboss.portal.server.util.HTTPStreamInfo;
 import org.jboss.portal.theme.navigation.PageNavigationalState;
 import org.jboss.portal.theme.navigation.WindowNavigationalState;
@@ -63,9 +63,9 @@
    private final Set supportedPortletModes;
    private final HTTPStreamInfo streamInfo;
    private final List localWindowContexts;
-   private final NavigationalStateContext navigationalStateContext;
+   private final AttributeResolver navigationalStateContext;
 
-   public StrategyContext(NavigationalStateContext navCtx, PageNavigationalState pageNavState,
+   public StrategyContext(AttributeResolver navCtx, PageNavigationalState pageNavState,
                           HttpServletRequest httpRequest, HTTPStreamInfo streamInfo,
                           Set windowStates, Set portletModes, List regionNames)
    {
@@ -148,13 +148,13 @@
 
    public WindowState getWindowState(WindowLocation portlet)
    {
-      WindowNavigationalState windowNavState = (WindowNavigationalState)navigationalStateContext.getNavigationalState(portlet.getWindowId() + "_window");
+      WindowNavigationalState windowNavState = (WindowNavigationalState)navigationalStateContext.getAttribute(portlet.getWindowId() + "_window");
       return windowNavState.getWindowState();
    }
 
    public Mode getPortletMode(WindowContext portlet)
    {
-      WindowNavigationalState windowNavState = (WindowNavigationalState)navigationalStateContext.getNavigationalState(portlet.getId() + "_window");
+      WindowNavigationalState windowNavState = (WindowNavigationalState)navigationalStateContext.getAttribute(portlet.getId() + "_window");
       return windowNavState.getMode();
    }
 
@@ -181,9 +181,9 @@
 
          // Create the missing nav state
          // todo fixme this is convoluted
-         if (navigationalStateContext.getNavigationalState(windowLocation.getWindowId() + "_window") == null)
+         if (navigationalStateContext.getAttribute(windowLocation.getWindowId() + "_window") == null)
          {
-            navigationalStateContext.setNavigationalState(windowLocation.getWindowId() + "_window", new WindowNavigationalState());
+            navigationalStateContext.setAttribute(windowLocation.getWindowId() + "_window", new WindowNavigationalState());
          }
 
          //

Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -67,12 +67,12 @@
 
    public void testAction() throws Exception
    {
-      TestInvocationContext ac = new TestInvocationContext();
+      TestPortletInvocationContext ac = new TestPortletInvocationContext();
       ActionInvocation action = new ActionInvocation(ac);
       action.setInstanceContext(new BasicInstanceContext(SOF.PORTLET_HANDLE_1));
       action.setSecurityContext(new BasicSecurityContext());
       action.setUserContext(new BasicUserContext());
-      action.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, SOF.PORTLET_HANDLE_1);
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, SOF.PORTLET_HANDLE_1);
 
       consumer.invoke(action);
 
@@ -83,7 +83,7 @@
       assertEquals("ns1", render.getNavigationalState().getStringValue());
 
       RenderInvocation renderInvocation = createRenderInvocation(SOF.PORTLET_HANDLE_1);
-      ((TestInvocationContext)renderInvocation.getContext()).ns = "ns1";
+      ((TestPortletInvocationContext)renderInvocation.getContext()).ns = "ns1";
       consumer.invoke(renderInvocation);
       checkRenderResult(renderInvocation, "portlet1:view:maximized:ns1");
    }
@@ -111,7 +111,7 @@
    {
       // first test that we don't initialize cookies if we don't need it
       RenderInvocation render = createRenderInvocation(SOF.PORTLET_HANDLE_1);
-      TestInvocationContext invocationContext = (TestInvocationContext)render.getContext();
+      TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
       HttpSession session = invocationContext.mockRequest.getSession();
       producer.setResponse(invocationContext.mockResponse);
 
@@ -124,7 +124,7 @@
       // now require cookie initialization and check that everything went well
       producer.setRequiresInitCookie(CookieProtocol.perUser);
       render = createRenderInvocation(SOF.PORTLET_HANDLE_1);
-      invocationContext = (TestInvocationContext)render.getContext();
+      invocationContext = (TestPortletInvocationContext)render.getContext();
       session = invocationContext.mockRequest.getSession();
       producer.setResponse(invocationContext.mockResponse);
 
@@ -148,10 +148,10 @@
 
    private RenderInvocation createRenderInvocation(String portletHandle)
    {
-      TestInvocationContext rc = new TestInvocationContext();
+      TestPortletInvocationContext rc = new TestPortletInvocationContext();
 
       RenderInvocation render = new RenderInvocation(rc);
-      render.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, portletHandle);
+      render.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, portletHandle);
 
       render.setInstanceContext(new BasicInstanceContext(portletHandle));
       render.setSecurityContext(new BasicSecurityContext());

Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -26,6 +26,8 @@
 import java.io.Serializable;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.HashMap;
 
 /**
  * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.MockHttpServletRequest">Chris
@@ -37,9 +39,12 @@
 {
    private HttpSession session;
 
+   private Map attrs;
+
    public MockHttpServletRequest(HttpSession session)
    {
       this.session = session;
+      this.attrs = new HashMap();
    }
 
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
@@ -61,6 +66,29 @@
       {
          return "MockHttpServletResponse";
       }
+      if ("getAttribute".equals(methodName))
+      {
+         return attrs.get(args[0]);
+      }
+      if ("setAttribute".equals(methodName))
+      {
+         String name = (String)args[0];
+         Object value = args[1];
+         if (value != null)
+         {
+            attrs.put(name, value);
+         }
+         else
+         {
+            attrs.remove(value);
+         }
+         return null;
+      }
+      if ("removeAttribute".equals(methodName))
+      {
+         String name = (String)args[0];
+         attrs.remove(name);
+      }
       throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
    }
 }

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,143 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.portal.test.wsrp.v1.consumer;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractInvocationContext;
-import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.portlet.spi.InvocationContext;
-import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.wsrp.WSRPConstants;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Proxy;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.TestInvocationContext">Chris
- *         Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class TestInvocationContext extends AbstractInvocationContext implements InvocationContext, RenderContext, ActionContext
-{
-   String ns;
-   HttpServletRequest mockRequest;
-   HttpServletResponse mockResponse;
-
-   public TestInvocationContext()
-   {
-      ClassLoader classLoader = getClass().getClassLoader();
-      HttpSession session = (HttpSession)Proxy.newProxyInstance(classLoader, new Class[]{HttpSession.class},
-         new MockHttpSession());
-      mockRequest = (HttpServletRequest)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletRequest.class},
-         new MockHttpServletRequest(session));
-      mockResponse = (HttpServletResponse)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletResponse.class},
-         new MockHttpServletResponse());
-   }
-
-   public StateString getNavigationalState()
-   {
-      return StateString.createFrom(ns);
-   }
-
-   public Mode getMode()
-   {
-      return Mode.VIEW;
-   }
-
-   public WindowState getWindowState()
-   {
-      return WindowState.MAXIMIZED;
-   }
-
-   public HTTPStreamInfo getStreamInfo()
-   {
-      return new HTTPStreamInfo(MediaType.HTML, WSRPConstants.DEFAULT_CHARACTER_SET);
-   }
-
-   public HttpServletRequest getClientRequest()
-   {
-      return mockRequest;
-   }
-
-   public HttpServletResponse getClientResponse()
-   {
-      return mockResponse;
-   }
-
-   public String encodeURL(String url)
-   {
-      return null;
-   }
-
-   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
-   {
-      return null;
-   }
-
-   public String getCharacterEncoding()
-   {
-      return null;
-   }
-
-   public int getContentLength()
-   {
-      return 0;
-   }
-
-   public BufferedReader getReader() throws IOException
-   {
-      return null;
-   }
-
-   public InputStream getInputStream() throws IOException
-   {
-      return null;
-   }
-
-   public String getContentType()
-   {
-      return null;
-   }
-
-   public StateString getInteractionState()
-   {
-      return null;
-   }
-
-   public Parameters getForm()
-   {
-      return null;
-   }
-}

Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,147 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.MediaType;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.ActionContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.server.impl.RequestAttributeResolver;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.wsrp.WSRPConstants;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.TestInvocationContext">Chris
+ *         Laprun</a>
+ * @version $Revision: 5064 $
+ * @since 2.4
+ */
+class TestPortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext, RenderContext, ActionContext
+{
+   String ns;
+   HttpServletRequest mockRequest;
+   HttpServletResponse mockResponse;
+
+   public TestPortletInvocationContext()
+   {
+      ClassLoader classLoader = getClass().getClassLoader();
+      HttpSession session = (HttpSession)Proxy.newProxyInstance(classLoader, new Class[]{HttpSession.class},
+         new MockHttpSession());
+      mockRequest = (HttpServletRequest)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletRequest.class},
+         new MockHttpServletRequest(session));
+      mockResponse = (HttpServletResponse)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletResponse.class},
+         new MockHttpServletResponse());
+
+      addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(mockRequest));
+   }
+
+   public StateString getNavigationalState()
+   {
+      return StateString.createFrom(ns);
+   }
+
+   public Mode getMode()
+   {
+      return Mode.VIEW;
+   }
+
+   public WindowState getWindowState()
+   {
+      return WindowState.MAXIMIZED;
+   }
+
+   public HTTPStreamInfo getStreamInfo()
+   {
+      return new HTTPStreamInfo(MediaType.HTML, WSRPConstants.DEFAULT_CHARACTER_SET);
+   }
+
+   public HttpServletRequest getClientRequest()
+   {
+      return mockRequest;
+   }
+
+   public HttpServletResponse getClientResponse()
+   {
+      return mockResponse;
+   }
+
+   public String encodeURL(String url)
+   {
+      return null;
+   }
+
+   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+   {
+      return null;
+   }
+
+   public String getCharacterEncoding()
+   {
+      return null;
+   }
+
+   public int getContentLength()
+   {
+      return 0;
+   }
+
+   public BufferedReader getReader() throws IOException
+   {
+      return null;
+   }
+
+   public InputStream getInputStream() throws IOException
+   {
+      return null;
+   }
+
+   public String getContentType()
+   {
+      return null;
+   }
+
+   public StateString getInteractionState()
+   {
+      return null;
+   }
+
+   public Parameters getForm()
+   {
+      return null;
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -30,7 +30,7 @@
 import org.jboss.portal.portlet.PortletURL;
 import org.jboss.portal.portlet.RenderURL;
 import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.spi.InvocationContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
 import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
 import org.jboss.portal.wsrp.core.CacheControl;
 import org.jboss.portal.wsrp.core.ClientData;
@@ -514,7 +514,7 @@
     * @param context
     * @return
     */
-   public static Templates createTemplates(InvocationContext context)
+   public static Templates createTemplates(PortletInvocationContext context)
    {
       Templates templates = new Templates();
 
@@ -530,7 +530,7 @@
       return templates;
    }
 
-   private static String createTemplate(InvocationContext context, PortletURL url, Boolean secure)
+   private static String createTemplate(PortletInvocationContext context, PortletURL url, Boolean secure)
    {
       String template = context.encodeURL(url, secure, null, true);
       template = Tools.replace(template, ENC_OPEN, OPEN);

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/aspects/portlet/SessionInterceptor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/aspects/portlet/SessionInterceptor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/aspects/portlet/SessionInterceptor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -59,8 +59,8 @@
          // portlet to which this invocation was dispatched interacted with session, we need to inform MarkupHandler
          if (previousSessionId == null || sessionId.equals(previousSessionId))
          {
-            invocation.setAttribute(WSRPProducer.SESSION_ID_ATTRIBUTE, sessionId);
-            invocation.setAttribute(WSRPProducer.SESSION_ATTRIBUTE, session);
+            invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, WSRPProducer.SESSION_ID_ATTRIBUTE, sessionId);
+            invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, WSRPProducer.SESSION_ATTRIBUTE, session);
          }
          else
          {

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -77,7 +77,7 @@
          WSRPTypeFactory.createInteractionParams(WSRPUtils.getStateChangeFromAccessMode(accessMode));
 
       // interaction state
-      ActionContext actionContext = (ActionContext)invocation.getContext();
+      ActionContext actionContext = (ActionContext)invocation.getPortletContext();
       StateString interactionState = actionContext.getInteractionState();
       if (interactionState != null)
       {

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -27,7 +27,7 @@
 import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.portlet.result.ErrorResult;
 import org.jboss.portal.portlet.result.FragmentResult;
-import org.jboss.portal.portlet.spi.InvocationContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
 import org.jboss.portal.wsrp.WSRPPortletURL;
 import org.jboss.portal.wsrp.WSRPRewritingConstants;
 import org.jboss.portal.wsrp.WSRPTypeFactory;
@@ -48,10 +48,9 @@
 public class RenderHandler extends InvocationHandler
 {
    private static final String SEPARATOR = "_";
+   private static final WSRPURLRewriter WSRP_URL_REWRITER = new WSRPURLRewriter();
    private static final ResourceURLRewriter RESOURCE_URL_REWRITER = new ResourceURLRewriter();
 
-   private final WSRPURLRewriter urlRewriter = new WSRPURLRewriter();
-
    public RenderHandler(WSRPConsumerImpl consumer)
    {
       super(consumer);
@@ -142,12 +141,12 @@
 
       if (rewriteURLs)
       {
-         urlRewriter.setContext(invocation.getContext());
-         urlRewriter.setSecure(invocation.getSecurityContext().isSecure());
+         WSRP_URL_REWRITER.setContext(invocation.getPortletContext());
+         WSRP_URL_REWRITER.setSecure(invocation.getSecurityContext().isSecure());
          String userId = invocation.getUserContext().getId();
-         urlRewriter.setAuthenticated(userId != null); // is this correct?
+         WSRP_URL_REWRITER.setAuthenticated(userId != null); // is this correct?
 
-         return URLTools.replaceURLsBy(markup, urlRewriter);
+         return URLTools.replaceURLsBy(markup, WSRP_URL_REWRITER);
       }
       else
       {
@@ -176,11 +175,11 @@
 
    private static class WSRPURLRewriter extends URLTools.URLReplacementGenerator
    {
-      private InvocationContext context;
+      private PortletInvocationContext context;
       private Boolean secure;
       private Boolean authenticated;
 
-      public void setContext(InvocationContext context)
+      public void setContext(PortletInvocationContext context)
       {
          this.context = context;
       }

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -27,7 +27,7 @@
 import org.jboss.portal.portlet.ParametersStateString;
 import org.jboss.portal.portlet.StateString;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.InvocationContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
 import org.jboss.portal.portlet.spi.SecurityContext;
 import org.jboss.portal.portlet.spi.UserContext;
 import org.jboss.portal.server.util.HTTPStreamInfo;
@@ -78,7 +78,7 @@
       // create markup params
       UserContext userContext = invocation.getUserContext();
       ParameterValidation.throwIllegalArgExceptionIfNull(userContext, USER_CONTEXT);
-      InvocationContext context = invocation.getContext();
+      PortletInvocationContext context = invocation.getPortletContext();
       ParameterValidation.throwIllegalArgExceptionIfNull(context, INVOCATION_CONTEXT);
       HTTPStreamInfo streamInfo = context.getStreamInfo();
       ParameterValidation.throwIllegalArgExceptionIfNull(streamInfo, STREAM_INFO);

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -24,17 +24,17 @@
 import org.jboss.portal.common.invocation.InvocationException;
 import org.jboss.portal.common.system.AbstractJBossService;
 import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.PropertyChange;
 import org.jboss.portal.portlet.InvokerUnavailableException;
 import org.jboss.portal.portlet.NoSuchPortletException;
 import org.jboss.portal.portlet.Portlet;
 import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.impl.spi.AbstractInvocationContext;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
 import org.jboss.portal.portlet.invocation.ActionInvocation;
 import org.jboss.portal.portlet.invocation.PortletInvocation;
 import org.jboss.portal.portlet.invocation.RenderInvocation;
 import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
 import org.jboss.portal.wsrp.UserContextConverter;
 import org.jboss.portal.wsrp.WSRPConstants;
 import org.jboss.portal.wsrp.WSRPConsumer;
@@ -63,9 +63,9 @@
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.List;
 
 /**
  * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -254,7 +254,7 @@
 
    static String getPortletHandle(PortletInvocation invocation)
    {
-      return (String)invocation.getAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE);
+      return (String)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE);
    }
 
    WSRPPortletInfo getPortletInfo(PortletInvocation invocation)
@@ -662,13 +662,13 @@
       {
          // we need to supply the templates since the portlet does URL processing and either doesn't store
          // templates in the session or no session has been established yet
-         runtimeContext.setTemplates(WSRPTypeFactory.createTemplates(invocation.getContext()));
+         runtimeContext.setTemplates(WSRPTypeFactory.createTemplates(invocation.getPortletContext()));
       }
    }
 
    static HttpServletRequest getHttpRequest(PortletInvocation invocation)
    {
-      AbstractInvocationContext invocationContext = (AbstractInvocationContext)invocation.getContext();
+      AbstractPortletInvocationContext invocationContext = (AbstractPortletInvocationContext)invocation.getContext();
       return invocationContext.getClientRequest();
    }
 

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -46,7 +46,7 @@
  * @version $Revision$
  * @since 2.4
  */
-public class WSRPActionContext extends WSRPInvocationContext implements ActionContext
+public class WSRPActionContext extends WSRPPortletInvocationContext implements ActionContext
 {
    private Parameters formParameters;
    private HttpServletRequest request;

Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -1,157 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.wsrp.invocation;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.impl.spi.AbstractInvocationContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.spi.InstanceContext;
-import org.jboss.portal.portlet.spi.InvocationContext;
-import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.portlet.spi.RequestContext;
-import org.jboss.portal.portlet.spi.SecurityContext;
-import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.wsrp.WSRPPortletURL;
-import org.jboss.portal.wsrp.WSRPRewritingConstants;
-import org.jboss.portal.wsrp.servlet.ServletAccess;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class WSRPInvocationContext extends AbstractInvocationContext implements InvocationContext
-{
-
-   protected RequestContext requestContext;
-   private StateString navigationalState;
-   private SecurityContext securityContext;
-   private HTTPStreamInfo streamInfo;
-   private PortalContext portalContext;
-   private UserContext userContext;
-   private InstanceContext instanceContext;
-   private WindowState windowState;
-   private Mode mode;
-   private WindowContext windowContext;
-
-   public WSRPInvocationContext(String sessionId, StateString navigationalState, SecurityContext securityContext,
-                                HTTPStreamInfo streamInfo, PortalContext portalContext, UserContext userContext,
-                                InstanceContext instanceContext, WindowContext windowContext, Mode mode, WindowState windowState)
-   {
-      this.navigationalState = navigationalState;
-      this.securityContext = securityContext;
-      this.streamInfo = streamInfo;
-      this.portalContext = portalContext;
-      this.userContext = userContext;
-      this.instanceContext = instanceContext;
-      this.windowContext = windowContext;
-      this.requestContext = new WSRPRequestContext(sessionId);
-      this.mode = mode;
-      this.windowState = windowState;
-   }
-
-   public HttpServletRequest getClientRequest()
-   {
-      return ServletAccess.getRequest();
-   }
-
-   public HttpServletResponse getClientResponse()
-   {
-      return ServletAccess.getResponse();
-   }
-
-   public StateString getNavigationalState()
-   {
-      return navigationalState;
-   }
-
-   public Mode getMode()
-   {
-      return mode;
-   }
-
-   public WindowState getWindowState()
-   {
-      return windowState;
-   }
-
-   public HTTPStreamInfo getStreamInfo()
-   {
-      return streamInfo;
-   }
-
-   /** Override the default behavior in order to avoid to encode when it is producer written URL. */
-   public String encodeURL(String url)
-   {
-      if (url != null && url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
-      {
-         // We don't encode URL through this API when it is a wsrp URL
-         return url;
-      }
-      else
-      {
-         return super.encodeURL(url);
-      }
-   }
-
-   /**
-    * <p>URL to be re-written are of the form: <code>wsrp_rewrite?wsrp-urlType=value&amp;amp;name1=value1&amp;amp;name2=value2
-    * .../wsrp_rewrite</code> </p> <ul>Examples: <li>Load a resource http://test.com/images/test.gif: <br/>
-    * <code>wsrp_rewrite?wsrp-urlType=resource&amp;amp;wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif&amp;amp;wsrp-requiresRewrite=true/wsrp_rewrite</code></li>
-    * <li>Declare a secure interaction back to the Portlet:<br/> <code>wsrp_rewrite?wsrp-urlType=blockingAction&amp;amp;wsrp-secureURL=true&amp;amp;wsrp-navigationalState=a8h4K5JD9&amp;amp;wsrp-interactionState=fg4h923mdk/wsrp_rewrite</code></li>
-    * <li>Request the Consumer render the Portlet in a different mode and window state:
-    * <code>wsrp_rewrite?wsrp-urlType=render&amp;amp;wsrp-mode=help&amp;amp;wsrp-windowState=maximized/wsrp_rewrite</code></li>
-    * </ul>
-    *
-    * @param portletURL
-    * @param wantSecure
-    * @param wantAuthenticated
-    * @param relative
-    * @return the encoded url
-    */
-   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
-   {
-      if (portletURL != null)
-      {
-         return WSRPPortletURL.create(portletURL, Boolean.TRUE.equals(wantSecure)).toString();
-      }
-      return null;
-   }
-
-   public void contextualize(PortletInvocation invocation)
-   {
-      invocation.setRequestContext(requestContext);
-      invocation.setSecurityContext(securityContext);
-      invocation.setInstanceContext(instanceContext);
-      invocation.setWindowContext(windowContext);
-      invocation.setPortalContext(portalContext);
-      invocation.setUserContext(userContext);
-   }
-}

Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -0,0 +1,161 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.wsrp.invocation;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.InstanceContext;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.server.impl.RequestAttributeResolver;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.wsrp.WSRPPortletURL;
+import org.jboss.portal.wsrp.WSRPRewritingConstants;
+import org.jboss.portal.wsrp.servlet.ServletAccess;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision: 5064 $
+ */
+public class WSRPPortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext
+{
+
+   protected RequestContext requestContext;
+   private StateString navigationalState;
+   private SecurityContext securityContext;
+   private HTTPStreamInfo streamInfo;
+   private PortalContext portalContext;
+   private UserContext userContext;
+   private InstanceContext instanceContext;
+   private WindowState windowState;
+   private Mode mode;
+   private WindowContext windowContext;
+
+   public WSRPPortletInvocationContext(String sessionId, StateString navigationalState, SecurityContext securityContext,
+                                       HTTPStreamInfo streamInfo, PortalContext portalContext, UserContext userContext,
+                                       InstanceContext instanceContext, WindowContext windowContext, Mode mode, WindowState windowState)
+   {
+      this.navigationalState = navigationalState;
+      this.securityContext = securityContext;
+      this.streamInfo = streamInfo;
+      this.portalContext = portalContext;
+      this.userContext = userContext;
+      this.instanceContext = instanceContext;
+      this.windowContext = windowContext;
+      this.requestContext = new WSRPRequestContext(sessionId);
+      this.mode = mode;
+      this.windowState = windowState;
+
+      //
+      addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(ServletAccess.getRequest()));
+   }
+
+   public HttpServletRequest getClientRequest()
+   {
+      return ServletAccess.getRequest();
+   }
+
+   public HttpServletResponse getClientResponse()
+   {
+      return ServletAccess.getResponse();
+   }
+
+   public StateString getNavigationalState()
+   {
+      return navigationalState;
+   }
+
+   public Mode getMode()
+   {
+      return mode;
+   }
+
+   public WindowState getWindowState()
+   {
+      return windowState;
+   }
+
+   public HTTPStreamInfo getStreamInfo()
+   {
+      return streamInfo;
+   }
+
+   /** Override the default behavior in order to avoid to encode when it is producer written URL. */
+   public String encodeURL(String url)
+   {
+      if (url != null && url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
+      {
+         // We don't encode URL through this API when it is a wsrp URL
+         return url;
+      }
+      else
+      {
+         return super.encodeURL(url);
+      }
+   }
+
+   /**
+    * <p>URL to be re-written are of the form: <code>wsrp_rewrite?wsrp-urlType=value&amp;amp;name1=value1&amp;amp;name2=value2
+    * .../wsrp_rewrite</code> </p> <ul>Examples: <li>Load a resource http://test.com/images/test.gif: <br/>
+    * <code>wsrp_rewrite?wsrp-urlType=resource&amp;amp;wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif&amp;amp;wsrp-requiresRewrite=true/wsrp_rewrite</code></li>
+    * <li>Declare a secure interaction back to the Portlet:<br/> <code>wsrp_rewrite?wsrp-urlType=blockingAction&amp;amp;wsrp-secureURL=true&amp;amp;wsrp-navigationalState=a8h4K5JD9&amp;amp;wsrp-interactionState=fg4h923mdk/wsrp_rewrite</code></li>
+    * <li>Request the Consumer render the Portlet in a different mode and window state:
+    * <code>wsrp_rewrite?wsrp-urlType=render&amp;amp;wsrp-mode=help&amp;amp;wsrp-windowState=maximized/wsrp_rewrite</code></li>
+    * </ul>
+    *
+    * @param portletURL
+    * @param wantSecure
+    * @param wantAuthenticated
+    * @param relative
+    * @return the encoded url
+    */
+   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+   {
+      if (portletURL != null)
+      {
+         return WSRPPortletURL.create(portletURL, Boolean.TRUE.equals(wantSecure)).toString();
+      }
+      return null;
+   }
+
+   public void contextualize(PortletInvocation invocation)
+   {
+      invocation.setRequestContext(requestContext);
+      invocation.setSecurityContext(securityContext);
+      invocation.setInstanceContext(instanceContext);
+      invocation.setWindowContext(windowContext);
+      invocation.setPortalContext(portalContext);
+      invocation.setUserContext(userContext);
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -36,7 +36,7 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class WSRPRenderContext extends WSRPInvocationContext implements RenderContext
+public class WSRPRenderContext extends WSRPPortletInvocationContext implements RenderContext
 {
 
    public WSRPRenderContext(String sessionId, StateString navigationalState, SecurityContext securityContext,

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java	2006-08-29 22:30:46 UTC (rev 5113)
@@ -195,7 +195,7 @@
          WSRPUtils.getJSR168WindowStateFromWSRPName(markupRequest.getWindowState()));
       RenderInvocation render = new RenderInvocation(renderContext);
       renderContext.contextualize(render);
-      render.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, portlet.getId());
+      render.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, portlet.getId());
 
       try
       {
@@ -250,12 +250,12 @@
          }
       }
 
-      sessionId = (String)render.getAttribute(WSRPProducer.SESSION_ID_ATTRIBUTE);
+      sessionId = (String)render.getAttribute(PortletInvocation.REQUEST_SCOPE, WSRPProducer.SESSION_ID_ATTRIBUTE);
       SessionContext sessionContext = null;
       if (sessionId != null)
       {
          sessionContext = WSRPTypeFactory.createSessionContext(sessionId, producer.getSessionExpirationTime());
-         producer.addSession((HttpSession)render.getAttribute(WSRPProducer.SESSION_ATTRIBUTE));
+         producer.addSession((HttpSession)render.getAttribute(PortletInvocation.REQUEST_SCOPE, WSRPProducer.SESSION_ATTRIBUTE));
       }
       return new MarkupResponse(markupContext, sessionContext, null);
    }
@@ -390,7 +390,7 @@
          markupRequest.getCharacterSet(), markupRequest.getMimeType());
       ActionInvocation invocation = new ActionInvocation(context);
       context.contextualize(invocation);
-      invocation.setAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE, portlet.getId());
+      invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_ID_ATTRIBUTE, portlet.getId());
 
       try
       {

Modified: trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -10,8 +10,8 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=WSRP"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=WSRP"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -41,7 +41,7 @@
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
-      <depends optional-attribute-name="Stack" proxy-type="attribute">portal:service=InterceptorStack,type=WSRP</depends>
+      <depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=WSRP</depends>
       <depends optional-attribute-name="Registry" proxy-type="attribute">portal:service=WebAppRegistry</depends>
    </mbean>
 

Modified: trunk/wsrp/src/resources/test-wsrp-producer-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/test-wsrp-producer-sar/META-INF/jboss-service.xml	2006-08-29 20:12:14 UTC (rev 5112)
+++ trunk/wsrp/src/resources/test-wsrp-producer-sar/META-INF/jboss-service.xml	2006-08-29 22:30:46 UTC (rev 5113)
@@ -52,8 +52,8 @@
       <xmbean/>
    </mbean>
    <mbean
-      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack"
-      name="portal:service=InterceptorStack,type=Container"
+      code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
+      name="portal:service=InterceptorStackFactory,type=Container"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
@@ -84,8 +84,8 @@
       xmbean-dd=""
       xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
       <xmbean/>
-      <depends optional-attribute-name="Stack"
-               proxy-type="attribute">portal:service=InterceptorStack,type=Container</depends>
+      <depends optional-attribute-name="StackFactory"
+               proxy-type="attribute">portal:service=InterceptorStackFactory,type=Container</depends>
       <depends optional-attribute-name="Registry" proxy-type="attribute">portal:service=WebAppRegistry</depends>
    </mbean>
 




More information about the jboss-svn-commits mailing list