[jboss-svn-commits] JBoss Portal SVN: r5602 - in trunk: common/src/main/org/jboss/portal/common core/src/main/org/jboss/portal/core/aspects/controller core/src/main/org/jboss/portal/core/controller/command core/src/main/org/jboss/portal/core/controller/portlet core/src/main/org/jboss/portal/core/model/portal core/src/main/org/jboss/portal/core/ui/configurator core/src/resources/portal-core-sar/META-INF portlet/src/main/org/jboss/portal/portlet portlet/src/main/org/jboss/portal/portlet/impl portlet/src/main/org/jboss/portal/portlet/invocation/response portlet/src/main/org/jboss/portal/portlet/test portlet/src/main/org/jboss/portal/test/portlet server/src/main/org/jboss/portal/server server/src/main/org/jboss/portal/server/servlet theme/src/main/org/jboss/portal/theme/navigation

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 8 12:25:49 EST 2006


Author: julien at jboss.com
Date: 2006-11-08 12:25:19 -0500 (Wed, 08 Nov 2006)
New Revision: 5602

Added:
   trunk/common/src/main/org/jboss/portal/common/FixMe.java
   trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java
   trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java
   trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java
   trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java
   trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
   trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityResponse.java
Removed:
   trunk/core/src/main/org/jboss/portal/core/ui/configurator/RenderPortletCommand.java
   trunk/portlet/src/main/org/jboss/portal/portlet/PortletRequestDecoder.java
   trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/AccessDeniedResponse.java
Modified:
   trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java
   trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
   trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
   trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
   trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
   trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
   trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java
   trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
   trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
   trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientPrivilegesResponse.java
   trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientTransportGuaranteeResponse.java
   trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityErrorResponse.java
   trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
   trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java
   trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java
   trunk/server/src/main/org/jboss/portal/server/ServerURL.java
   trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
   trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java
Log:
start to have a configuration page having for now UserPortlet

Added: trunk/common/src/main/org/jboss/portal/common/FixMe.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/FixMe.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/common/src/main/org/jboss/portal/common/FixMe.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FixMe extends UnsupportedOperationException
+{
+   public FixMe()
+   {
+      super("Fix me");
+   }
+
+   public FixMe(String featureName)
+   {
+      super("Feature: " + featureName + " needs to be fixed");
+   }
+}

Modified: trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -35,6 +35,6 @@
 
    public NotYetImplemented(String featureName)
    {
-      super("Feature : " + featureName + " is not yet implemented");
+      super("Feature: " + featureName + " is not yet implemented");
    }
 }

Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -66,16 +66,12 @@
 public class PageCustomizerInterceptor extends ControllerInterceptor
 {
 
-   /**
-    * .
-    */
+   /** . */
    private static final String RESOURCE_PREFIX = "PAGENAME_";
 
    private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
 
-   /**
-    * Tab order *
-    */
+   /** Tab order. */
    private static final String ORDER = "order";
 
    public PortalAuthorizationManagerFactory getPortalAuthorizationManagerFactory()
@@ -93,103 +89,115 @@
       Object resp = cmd.invokeNext();
 
       // Insert navigation portlet in the page
-      if (cmd instanceof RenderPageCommand)
+      if (resp instanceof PageRendition)
       {
-         RenderPageCommand rpc = (RenderPageCommand)cmd;
          PageRendition rendition = (PageRendition)resp;
-         if (rendition != null)
+
+         // No tab in dashboard mode TODO: why not?
+         if (cmd instanceof RenderPageCommand)
          {
-            // No tab in dashboard mode TODO: why not?
-            if (rpc.isDashboard() == false)
+            RenderPageCommand rpc = (RenderPageCommand)cmd;
+            StringBuffer tabbedNav = injectTabbedNav(rpc);
+            if (tabbedNav != null)
             {
-               StringBuffer tabbedNav = injectTabbedNav(rpc);
-               if (tabbedNav != null)
-               {
-                  Map windowProps = new HashMap();
-
-                  windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
-                  windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
-                  windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
-                  WindowResult res = new ModifiableWindowResult("", tabbedNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
-                  WindowContext blah = new WindowContext("BLAH", "BLAH", "navigation", 0);
-                  rendition.getPageResult().addWindowContext(blah);
-                  rendition.getPageResult().addWindowResult("BLAH", res);
-
-                  //
-                  Region region = rendition.getPageResult().getRegion("navigation");
-                  region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
-               }
-            }
-
-            StringBuffer dashboardNav = injectDashboardNav(rpc);
-            if (dashboardNav != null)
-            {
                Map windowProps = new HashMap();
                windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
                windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
                windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
-               WindowResult res = new ModifiableWindowResult("", dashboardNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
-               WindowContext bluh = new WindowContext("BLUH", "BLUH", "dashboardnav", 0);
-               rendition.getPageResult().addWindowContext(bluh);
-               rendition.getPageResult().addWindowResult("BLUH", res);
+               WindowResult res = new ModifiableWindowResult("", tabbedNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+               WindowContext blah = new WindowContext("BLAH", "BLAH", "navigation", 0);
+               rendition.getPageResult().addWindowContext(blah);
+               rendition.getPageResult().addWindowResult("BLAH", res);
 
                //
-               Region region = rendition.getPageResult().getRegion("dashboardnav");
+               Region region = rendition.getPageResult().getRegion("navigation");
                region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
             }
          }
+
+         //
+         StringBuffer dashboardNav = injectDashboardNav(cmd);
+         if (dashboardNav != null)
+         {
+            Map windowProps = new HashMap();
+            windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
+            windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
+            windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
+            WindowResult res = new ModifiableWindowResult("", dashboardNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+            WindowContext bluh = new WindowContext("BLUH", "BLUH", "dashboardnav", 0);
+            rendition.getPageResult().addWindowContext(bluh);
+            rendition.getPageResult().addWindowResult("BLUH", res);
+
+            //
+            Region region = rendition.getPageResult().getRegion("dashboardnav");
+            region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
+         }
       }
 
       //
       return resp;
    }
 
-   public StringBuffer injectDashboardNav(RenderPageCommand rpc)
+   public StringBuffer injectDashboardNav(ControllerCommand cc)
    {
       StringBuffer sb = new StringBuffer();
-      if (rpc.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() == null)
+      if (cc.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() == null)
       {
-         URLContext ctx = rpc.getControllerContext().getServerInvocation().getServerContext().getURLContext();
+         URLContext ctx = cc.getControllerContext().getServerInvocation().getServerContext().getURLContext();
          ctx = URLContext.newInstance(ctx.getSecure(), true);
-         String loginURL = rpc.getControllerContext().encodeURL(rpc, ctx, null);
+         String loginURL = cc.getControllerContext().encodeURL(cc, ctx, null);
          sb.append("<a href=\"").append(loginURL).append("\">Login</a>");
       }
       else
       {
-         boolean dashboard = rpc.isDashboard();
-         String pageURL = null;
-         String label = null;
+         boolean dashboard = false;
+         if (cc instanceof RenderPageCommand)
+         {
+            RenderPageCommand rpc = (RenderPageCommand)cc;
+            dashboard = rpc.isDashboard();
+         }
+         String pageURL;
+         String label;
          if (dashboard)
          {
             RenderPageCommand _rpc = new RenderPageCommand("default.default");
-            pageURL = rpc.getControllerContext().encodeURL(_rpc, null, null);
+            pageURL = cc.getControllerContext().encodeURL(_rpc, null, null);
             label = "Pages";
          }
          else
          {
             ViewDashboardCommand vdc = new ViewDashboardCommand("dashboard");
-            pageURL = rpc.getControllerContext().encodeURL(vdc, null, null);
+            pageURL = cc.getControllerContext().encodeURL(vdc, null, null);
             label = "My Dashboard";
          }
 
          // Link to admin/default portal
          String showadminURL = null;
          String showDefaultURL = null;
-         PortalObject portalObject = rpc.getPage().getPortal();
-         if ("admin".equalsIgnoreCase(portalObject.getName())) // are we in admin portal?
+
+         // Recode me, it's not a good criteria
+         boolean admin = false;
+         if (cc instanceof RenderPageCommand)
          {
+            RenderPageCommand rpc = (RenderPageCommand)cc;
+            PortalObject portalObject = rpc.getPage().getPortal();
+            admin = "admin".equalsIgnoreCase(portalObject.getName());
+         }
+
+         if (admin)
+         {
             RenderPageCommand showDefault = new RenderPageCommand("default");
-            showDefaultURL = rpc.getControllerContext().encodeURL(showDefault, null, null);
+            showDefaultURL = cc.getControllerContext().encodeURL(showDefault, null, null);
          }
          else
          {
             PortalObjectPermission perm = new PortalObjectPermission("admin", PortalObjectPermission.VIEW_MASK);
             try
             {
-               if (rpc.getControllerContext().getController().getPortalAuthorizationManagerFactory().getManager().checkPermission(perm))
+               if (cc.getControllerContext().getController().getPortalAuthorizationManagerFactory().getManager().checkPermission(perm))
                {
                   RenderPageCommand showadmin = new RenderPageCommand("admin");
-                  showadminURL = rpc.getControllerContext().encodeURL(showadmin, null, null);
+                  showadminURL = cc.getControllerContext().encodeURL(showadmin, null, null);
                }
             }
             catch (PortalSecurityException e)
@@ -200,11 +208,11 @@
 
          // TODO: add checks for shared/private pages
          SignOutCommand cmd = new SignOutCommand();
-         String logoutURL = rpc.getControllerContext().encodeURL(cmd, null, null);
+         String logoutURL = cc.getControllerContext().encodeURL(cmd, null, null);
 
          //sb.append("<a href=\"#\" class=\"addcontent\">Add Content</a>");
 
-         User user = (User)rpc.getControllerContext().getServerInvocation().getRequest().getUser();
+         User user = (User)cc.getControllerContext().getServerInvocation().getRequest().getUser();
          if (user != null)
          {
             sb.append("Logged in as: ").append(user.getUserName());

Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -27,11 +27,11 @@
 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.common.NotYetImplemented;
 import org.jboss.portal.core.controller.ControllerCommand;
 import org.jboss.portal.core.controller.ControllerContext;
 import org.jboss.portal.core.controller.ControllerException;
 import org.jboss.portal.core.controller.ControllerSecurityException;
-import org.jboss.portal.core.controller.InsufficientTransportGuaranteeException;
 import org.jboss.portal.core.controller.ResourceAccessDeniedException;
 import org.jboss.portal.core.controller.ResourceNotFoundException;
 import org.jboss.portal.core.controller.command.info.CommandInfo;
@@ -261,8 +261,36 @@
 
          // Call the portlet container to create the markup fragment(s) for each portlet that needs to render itself
          ServerConfig cfg = sinv.getRequest().getServer().getConfig();
-         ModifiablePageResult renderResult = renderFragments(cfg, navCtx);
+         ModifiablePageResult renderResult = new ModifiablePageResult(getPage().getName(), new HashMap(getPage().getDeclaredProperties()), new HashMap(getPage().getPortal().getDeclaredProperties()));
 
+         // Render
+         for (Iterator i = windows.iterator(); i.hasNext();)
+         {
+            PortalObject o = (PortalObject)i.next();
+            if (o instanceof Window)
+            {
+               Window window = (Window)o;
+               if (pageNavState.isWindowVisible(window.getId()))
+               {
+                  Object res = renderPortletWindow(cfg, window);
+                  if (res == null)
+                  {
+                     // Skip
+                  }
+                  else if (res instanceof MarkupResult)
+                  {
+                     MarkupResult result = (MarkupResult)res;
+                     renderResult.addWindowContext(pageNavState.getWindowContext(window.getId()));
+                     renderResult.addWindowResult(window.getId(), (WindowResult)result);
+                  }
+                  else
+                  {
+                     return res;
+                  }
+               }
+            }
+         }
+
          // Make the theme available as servlet request attribute (needed for CM)
          if (theme != null)
          {
@@ -290,47 +318,6 @@
       return null;
    }
 
-   /**
-    * Call the component invocation(s) to create the markup fragment(s) for this request Call the component / portlet
-    * invocation for each window on the page, and create a markup result with the resulting markup fragments in it
-    *
-    * @param cfg    the server configuration to get access to customizable error behaviour
-    * @param navCtx the navigational state context to access page and window navigational state
-    * @return a modifiable page result containing the markup fragments from the individual portlets on this page
-    * @throws InvocationException
-    */
-   private ModifiablePageResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws ControllerException
-   {
-      PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
-      ModifiablePageResult pageResult = new ModifiablePageResult(getPage().getName(), new HashMap(getPage().getDeclaredProperties()), new HashMap(getPage().getPortal().getDeclaredProperties()));
-
-      // Render
-      for (Iterator i = windows.iterator(); i.hasNext();)
-      {
-         PortalObject o = (PortalObject)i.next();
-
-         // Render only window children
-         if (o instanceof Window)
-         {
-            Window window = (Window)o;
-
-            // That are visible ?
-            if (pageNavState.isWindowVisible(window.getId()))
-            {
-               MarkupResult result = renderPortletWindow(cfg, window);
-               if (result != null)
-               {
-                  pageResult.addWindowContext(pageNavState.getWindowContext(window.getId()));
-                  pageResult.addWindowResult(window.getId(), (WindowResult)result);
-               }
-            }
-         }
-      }
-
-      return pageResult;
-   }
-
-
    private PortalTheme getTheme(String themeIdString)
    {
       //
@@ -400,7 +387,7 @@
     * @return a result containing markup, or other result information (redirect url, etc.)
     * @throws InvocationException
     */
-   protected MarkupResult renderPortletWindow(ServerConfig cfg, Window window) throws ControllerException
+   protected Object renderPortletWindow(ServerConfig cfg, Window window) throws ControllerException
    {
       // Execute render command
       String windowRef = window.getId();
@@ -419,21 +406,19 @@
          RenderWindowCommand renderCmd = new RenderWindowCommand(windowRef);
 
          //
-         PortletResponse pr = (PortletResponse)context.execute(renderCmd);
+         PortletResponse portletResponse = (PortletResponse)context.execute(renderCmd);
+         PortletInvocationResponse response = portletResponse.getResult();
 
          //
-         PortletInvocationResponse pir = pr.getResult();
-
-         //
-         if (pir instanceof InsufficientTransportGuaranteeResponse)
+         if (response instanceof InsufficientTransportGuaranteeResponse)
          {
-            throw new InsufficientTransportGuaranteeException();
+            return response;
          }
 
          //
-         if (pir instanceof FragmentResponse)
+         if (response instanceof FragmentResponse)
          {
-            FragmentResponse fragment = (FragmentResponse)pir;
+            FragmentResponse fragment = (FragmentResponse)response;
             windowTitle = fragment.getTitle();
             if (windowTitle == null)
             {
@@ -471,7 +456,6 @@
             }
 
             // Remove edit mode if the user is not logged it
-            // commenting out for now since it breaks the tests
             if (getControllerContext().getServerInvocation().getServerContext().getClientRequest().getUserPrincipal() == null)
             {
                supportedModes.remove(Mode.EDIT);
@@ -483,25 +467,15 @@
             //
             addStateActions(window, actionMap, windowNavState.getWindowState(), supportedWindowStates);
 
-            switch (fragment.getType())
-            {
-               case FragmentResponse.TYPE_CHARS:
-                  contentChars = fragment.getChars().toString();
-                  break;
-               case FragmentResponse.TYPE_BYTES:
-                  // Funny for now we don't know how to interpret that or we should not
-                  // because it is for some kind of flash portal ?
-                  contentChars = fragment.getBytes().toString();
-                  break;
-               case FragmentResponse.TYPE_EMPTY:
-                  // Do nothing, the contentChars is already empty string
-                  break;
-            }
+            //
+            contentChars = fragment.getContent();
+
+            //
             return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
          }
-         else if (pir instanceof ErrorResponse)
+         else if (response instanceof ErrorResponse)
          {
-            ErrorResponse errorResult = (ErrorResponse)pir;
+            ErrorResponse errorResult = (ErrorResponse)response;
             String logMessage = "Rendering portlet window " + windowRef + " triggered the following error :";
             errorResult.logErrorTo(ControllerCommand.log, logMessage);
             String property = cfg.getProperty(WINDOW_ERROR);
@@ -518,7 +492,7 @@
                return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
             }
          }
-         else if (pir instanceof UnavailableResponse)
+         else if (response instanceof UnavailableResponse)
          {
             if (SHOW.equals(cfg.getProperty(WINDOW_UNAVAILABLE)))
             {
@@ -531,15 +505,14 @@
                return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
             }
          }
-         else if (pir instanceof InsufficientPrivilegesResponse)
+         else if (response instanceof InsufficientPrivilegesResponse)
          {
             // Julien : go to the section below, I know it is very ugly
             throw new ResourceAccessDeniedException(windowRef);
          }
          else
          {
-            ControllerCommand.log.error("Unexpected result from a portlet invocation " + pir);
-            return null;
+            throw new NotYetImplemented("Unexpected result from a portlet invocation " + response);
          }
       }
       catch (ResourceAccessDeniedException e)
@@ -633,7 +606,7 @@
       for (Iterator j = supportedWindowStates.iterator(); j.hasNext();)
       {
          WindowState windowState = (WindowState)j.next();
-         String url = cleanQueryString(createUpdateNavigationalStateURL(window, null, windowState));
+         String url = createUpdateNavigationalStateURL(window, null, windowState);
          boolean disabled = windowState.equals(currentWindowState);
          WindowResult.Action action = new WindowResult.Action(windowState, url, !disabled);
          windowStates.add(action);
@@ -651,7 +624,7 @@
       for (Iterator j = supportedModes.iterator(); j.hasNext();)
       {
          Mode mode = (Mode)j.next();
-         String url = cleanQueryString(createUpdateNavigationalStateURL(window, mode, null));
+         String url = createUpdateNavigationalStateURL(window, mode, null);
          boolean disabled = mode.equals(currentMode);
          WindowResult.Action action = new WindowResult.Action(mode, url, !disabled);
          modes.add(action);
@@ -669,36 +642,4 @@
       URLContext urlContext = URLContext.newInstance(secure, authenticated);
       return controllerContext.encodeURL(cmd, urlContext, URLFormat.newInstance(true, true));
    }
-
-   /**
-    * Fixes href urls by replacing with html character entities.
-    *
-    * @param url
-    * @return
-    */
-   public static String cleanQueryString(String url)
-   {
-      final StringBuffer cleansed = new StringBuffer();
-
-      final StringCharacterIterator iterator = new StringCharacterIterator(url);
-      char currentChar = iterator.current();
-      while (currentChar != CharacterIterator.DONE)
-      {
-         if (currentChar == '\"')
-         {
-            cleansed.append("&quot;");
-         }
-         else if (currentChar == '&')
-         {
-            cleansed.append("&amp;");
-         }
-         else
-         {
-            cleansed.append(currentChar);
-         }
-         currentChar = iterator.next();
-      }
-      return cleansed.toString();
-   }
-
 }

Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -27,16 +27,136 @@
 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.impl.spi.AbstractRequestContext;
+import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
 
+import java.util.Set;
+import java.util.Map;
+import java.util.Collections;
+
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision: 1.1 $
  */
-public interface PortletContextFactory
+public class PortletContextFactory
 {
-   PortalContext createPortalContext();
-   RequestContext createRequestContext();
-   SecurityContext createSecurityContext();
-   UserContext createUserContext();
-   WindowContext createWindowContext();
+
+   /** . */
+   private PortalContext portalContext;
+
+   /** . */
+   private RequestContext requestContext;
+
+   /** . */
+   private SecurityContext securityContext;
+
+   /** . */
+   private UserContext userContext;
+
+   /** . */
+   private WindowContext windowContext;
+
+   public PortletContextFactory(ControllerContext controllerContext, Portal portal, Window window)
+   {
+      this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
+      this.securityContext = new AbstractSecurityContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
+      this.userContext = new ControllerUserContext(controllerContext.getServerInvocation());
+      this.portalContext = new org.jboss.portal.core.model.portal.PortalContextImpl(portal);
+      this.windowContext = new org.jboss.portal.core.model.portal.WindowContextImpl(window);
+   }
+
+   public PortletContextFactory(ControllerContext controllerContext)
+   {
+      this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
+      this.securityContext = new AbstractSecurityContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
+      this.userContext = new ControllerUserContext(controllerContext.getServerInvocation());
+      this.portalContext = portalContextImpl;
+      this.windowContext = new WindowContextImpl("abc"); // Well ????
+   }
+
+   public PortalContext createPortalContext()
+   {
+      return portalContext;
+   }
+
+   public RequestContext createRequestContext()
+   {
+      return requestContext;
+   }
+
+   public SecurityContext createSecurityContext()
+   {
+      return securityContext;
+   }
+
+   public UserContext createUserContext()
+   {
+      return userContext;
+   }
+
+   public WindowContext createWindowContext()
+   {
+      return windowContext;
+   }
+
+   /** . */
+   private static final PortalContextImpl portalContextImpl = new PortalContextImpl();
+
+   private static class PortalContextImpl implements PortalContext
+   {
+
+      /** . */
+      private final Set windowStates;
+
+      /** . */
+      private final Set modes;
+
+      /** . */
+      private final Map props;
+
+      public PortalContextImpl()
+      {
+         windowStates = Collections.unmodifiableSet(new CollectionBuilder().add(WindowState.MAXIMIZED).add(WindowState.MINIMIZED).add(WindowState.NORMAL).toHashSet());
+         modes = Collections.unmodifiableSet(new CollectionBuilder().add(Mode.EDIT).add(Mode.HELP).add(Mode.VIEW).toHashSet());
+         props = Collections.EMPTY_MAP;
+      }
+
+      public Set getWindowStates()
+      {
+         return windowStates;
+      }
+
+      public Set getModes()
+      {
+         return modes;
+      }
+
+      public Map getProperties()
+      {
+         return props;
+      }
+   }
+
+   private static class WindowContextImpl implements WindowContext
+   {
+
+      /** . */
+      private String id;
+
+      public WindowContextImpl(String id)
+      {
+         this.id = id;
+      }
+
+      public String getId()
+      {
+         return id;
+      }
+   }
 }

Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -32,23 +32,14 @@
 import org.jboss.portal.portlet.RenderURL;
 import org.jboss.portal.portlet.impl.spi.AbstractActionContext;
 import org.jboss.portal.portlet.impl.spi.AbstractRenderContext;
-import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
-import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
 import org.jboss.portal.portlet.spi.ActionContext;
 import org.jboss.portal.portlet.spi.RenderContext;
-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.core.controller.ControllerContext;
 import org.jboss.portal.core.controller.ControllerCommand;
 import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
 import org.jboss.portal.core.controller.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.Mode;
 import org.jboss.portal.WindowState;
 import org.jboss.portal.common.invocation.EmptyAttributeResolver;
@@ -75,7 +66,7 @@
       Window window,
       Portal portal)
    {
-      PortletContextFactory cf = new InternalPortletContextFactory(controllerContext, portal, window);
+      PortletContextFactory cf = new PortletContextFactory(controllerContext, portal, window);
       InternalPortletCommandFactory cpc = new InternalPortletCommandFactory(window, controllerContext);
       return createRender(controllerContext, mode, windowState, navigationalState, cf, cpc);
    }
@@ -91,7 +82,7 @@
       Window window,
       Portal portal)
    {
-      PortletContextFactory cf = new InternalPortletContextFactory(controllerContext, portal, window);
+      PortletContextFactory cf = new PortletContextFactory(controllerContext, portal, window);
       InternalPortletCommandFactory cpc = new InternalPortletCommandFactory(window, controllerContext);
       return createAction(controllerContext, mode, windowState,  navigationalState, interactionState, form, cf, cpc);
    }
@@ -296,58 +287,4 @@
          return new InvokeWindowRenderCommand(window.getId(), renderURL.getMode(), renderURL.getWindowState(), renderURL.getNavigationalState());
       }
    }
-
-   private static class InternalPortletContextFactory implements PortletContextFactory
-   {
-
-      /** . */
-      private PortalContext portalContext;
-
-      /** . */
-      private RequestContext requestContext;
-
-      /** . */
-      private SecurityContext securityContext;
-
-      /** . */
-      private UserContext userContext;
-
-      /** . */
-      private WindowContext windowContext;
-
-      public InternalPortletContextFactory(ControllerContext controllerContext, Portal portal, Window window)
-      {
-
-         this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
-         this.securityContext = new AbstractSecurityContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
-         this.userContext = new ControllerUserContext(controllerContext.getServerInvocation());
-         this.portalContext = new PortalContextImpl(portal);
-         this.windowContext = new WindowContextImpl(window);
-      }
-
-      public PortalContext createPortalContext()
-      {
-         return portalContext;
-      }
-
-      public RequestContext createRequestContext()
-      {
-         return requestContext;
-      }
-
-      public SecurityContext createSecurityContext()
-      {
-         return securityContext;
-      }
-
-      public UserContext createUserContext()
-      {
-         return userContext;
-      }
-
-      public WindowContext createWindowContext()
-      {
-         return windowContext;
-      }
-   }
 }

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-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -29,7 +29,7 @@
 import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
 import org.jboss.portal.core.controller.command.RenderPageCommand;
 import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.portlet.PortletRequestDecoder;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
 import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.servlet.PathMapping;
 import org.jboss.portal.server.servlet.PathMappingResult;

Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -31,17 +31,12 @@
 import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
 import org.jboss.portal.core.controller.command.RenderPageCommand;
 import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.PortletRequestDecoder;
 import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.PortletRequestEncoder;
 import org.jboss.portal.server.AbstractServerURL;
 import org.jboss.portal.server.ServerInvocation;
 import org.jboss.portal.server.ServerURL;
 
-import java.util.Iterator;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
@@ -96,108 +91,23 @@
          // The base URL
          AbstractServerURL serverURL = getBaseURL(iwaCmd.getTargetId());
 
-         // The meta param
-         int meta = 0;
+         Mode mode = iwaCmd.getMode();
+         WindowState windowState = iwaCmd.getWindowState();
 
-         // Add parameters in the URL
-         Parameters parameters = null;
-
          //
          if (iwaCmd instanceof InvokeWindowActionCommand)
          {
-            meta = PortletRequestDecoder.ACTION_MASK;
-
-            //
             StateString interactionState = ((InvokeWindowActionCommand)iwaCmd).getInteractionState();
             StateString navigationalState = ((InvokeWindowActionCommand)iwaCmd).getNavigationalState();
-
-            //
-            if (interactionState != null)
-            {
-               if (interactionState instanceof ParametersStateString)
-               {
-                  if (navigationalState != null)
-                  {
-                     throw new IllegalArgumentException("Cannot handle case with both non opaque interaction and navigational state");
-                  }
-
-                  //
-                  parameters = ((ParametersStateString)interactionState).getParameters();
-               }
-               else
-               {
-                  meta |= PortletRequestDecoder.OPAQUE_MASK;
-
-                  // Set interaction state
-                  serverURL.setParameterValue(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, interactionState.getStringValue());
-
-                  // We may have navigational state
-                  if (navigationalState != null)
-                  {
-                     serverURL.setParameterValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
-                  }
-               }
-            }
+            PortletRequestEncoder.encodeAction(serverURL, navigationalState, interactionState, mode, windowState);
          }
-         else if (iwaCmd instanceof InvokeWindowRenderCommand)
+         else 
          {
-            meta = PortletRequestDecoder.RENDER_MASK;
-
-            //
             StateString navigationalState = ((InvokeWindowRenderCommand)iwaCmd).getNavigationalState();
-
-            //
-            if (navigationalState != null)
-            {
-               if (navigationalState instanceof ParametersStateString)
-               {
-                  parameters = ((ParametersStateString)navigationalState).getParameters();
-               }
-               else
-               {
-                  meta |= PortletRequestDecoder.OPAQUE_MASK;
-
-                  //
-                  serverURL.setParameterValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
-               }
-            }
+            PortletRequestEncoder.encodeRender(serverURL, navigationalState, mode, windowState);
          }
 
-         // Add the parameters
-         if (parameters != null)
-         {
-            for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
-            {
-               Map.Entry entry = (Map.Entry)i.next();
-               String name = (String)entry.getKey();
-               String[] values = (String[])entry.getValue();
-               serverURL.setParameterValues(name, values);
-            }
-         }
-
          //
-         Mode mode = iwaCmd.getMode();
-         if (mode != null)
-         {
-            meta |= PortletRequestDecoder.MODE_MASK;
-            setMetaParameter(serverURL, PortletRequestDecoder.MODE_PARAMETER, mode.toString());
-         }
-
-         //
-         WindowState windowState = iwaCmd.getWindowState();
-         if (windowState != null)
-         {
-            meta |= PortletRequestDecoder.WINDOW_STATE_MASK;
-            setMetaParameter(serverURL, PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
-         }
-
-         //
-         if (meta != 0)
-         {
-            setMetaParameter(serverURL, PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
-         }
-
-         //
          return serverURL;
       }
       else
@@ -206,23 +116,6 @@
       }
    }
 
-   private void setMetaParameter(AbstractServerURL serverURL, String name, String value)
-   {
-      String[] values = serverURL.getParameterValues(name);
-      if (values == null)
-      {
-         values = new String[]{value};
-      }
-      else
-      {
-         String[] tmp = new String[values.length + 1];
-         System.arraycopy(values, 0, tmp, 1, values.length);
-         tmp[0] = value;
-         values = tmp;
-      }
-      serverURL.setParameterValues(name, values);
-   }
-
    private AbstractServerURL getBaseURL(String objectRef)
    {
       //

Modified: trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -24,14 +24,14 @@
 
 import org.jboss.portal.core.controller.ControllerCommand;
 import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.portlet.PortletRequestDecoder;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
 import org.jboss.portal.server.ServerInvocation;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision: 1.1 $
  */
-public abstract class ConfiguratorCommandFactory extends AbstractCommandFactory
+public class ConfiguratorCommandFactory extends AbstractCommandFactory
 {
 
    public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
@@ -63,7 +63,10 @@
     */
    public ControllerCommand createPortletActionCommand(PortletRequestDecoder decoder)
    {
-      return null;
+      return new InvokePortletActionCommand(
+         decoder.getNavigationalstate(),
+         decoder.getInteractionState(),
+         decoder.getForm());
    }
 
    /**
@@ -71,7 +74,7 @@
     */
    protected ControllerCommand createPortletRenderCommand(PortletRequestDecoder decoder)
    {
-      return null;
+      return new InvokePortletRenderCommand(decoder.getNavigationalstate());
    }
 
    /**
@@ -79,6 +82,6 @@
     */
    protected ControllerCommand createPortletNavCommand(PortletRequestDecoder decoder)
    {
-      return null;
+      return new InvokePortletRenderCommand(decoder.getNavigationalstate());
    }
 }

Added: trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.ui.configurator;
+
+import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.portlet.impl.PortletRequestEncoder;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfiguratorURLFactory extends URLFactoryDelegate
+{
+
+   /** . */
+   private String path;
+
+   protected String[] getCommandClassNames()
+   {
+      return new String[]{
+         InvokePortletRenderCommand.class.getName(),
+         InvokePortletActionCommand.class.getName()
+      };
+   }
+
+   public String getPath()
+   {
+      return path;
+   }
+
+   public void setPath(String path)
+   {
+      this.path = path;
+   }
+
+   public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
+   {
+      ServerURL url = new AbstractServerURL();
+      url.setPortalRequestPath(path);
+      if (cmd instanceof InvokePortletRenderCommand)
+      {
+         InvokePortletRenderCommand iprc = (InvokePortletRenderCommand)cmd;
+         PortletRequestEncoder.encodeRender(url, iprc.getNavigationalState(), null, null);
+      }
+      else 
+      {
+         InvokePortletActionCommand iprc = (InvokePortletActionCommand)cmd;
+         PortletRequestEncoder.encodeAction(url, iprc.getNavigationalState(), iprc.getInteractionState(), null, null);
+      }
+      return url;
+   }
+}

Added: trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.ui.configurator;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+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: 1.1 $
+ */
+public class InvokePortletActionCommand extends ControllerCommand
+{
+
+   /** The navigational state. */
+   private StateString navigationalState;
+
+   /** The interaction state. */
+   private StateString interactionState;
+
+   /** The nform. */
+   private Parameters form;
+
+   /** The instance displayed. */
+   private Instance instance;
+
+   public InvokePortletActionCommand(StateString navigationalState, StateString interactionState, Parameters form)
+   {
+      this.navigationalState = navigationalState;
+      this.interactionState = interactionState;
+      this.form = form;
+   }
+
+
+   public StateString getNavigationalState()
+   {
+      return navigationalState;
+   }
+
+   public StateString getInteractionState()
+   {
+      return interactionState;
+   }
+
+   public Parameters getForm()
+   {
+      return form;
+   }
+
+   protected void create() throws ControllerException
+   {
+//      InstanceContainer container = context.getController().getInstanceContainer();
+//      instance = container.getInstance(instanceId);
+
+      //
+      if (instance == null)
+      {
+         // Do smth clever
+      }
+   }
+
+   public CommandInfo getInfo()
+   {
+      return null;
+   }
+
+   public Object execute() throws ControllerException
+   {
+//      ControllerRenderContext ctx = new ControllerRenderContext(
+//         context,
+//         context.getServerInvocation().getServerContext(),
+//      );
+
+
+      return null;
+   }
+}

Copied: trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java (from rev 5597, trunk/core/src/main/org/jboss/portal/core/ui/configurator/RenderPortletCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/RenderPortletCommand.java	2006-11-07 22:16:29 UTC (rev 5597)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,170 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.ui.configurator;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletContextFactory;
+import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.response.PortletResponse;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.theme.PageRendition;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.navigation.PageNavigationalState;
+import org.jboss.portal.theme.page.PageService;
+import org.jboss.portal.theme.page.ModifiablePageResult;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.ModifiableWindowResult;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletRenderCommand extends ControllerCommand
+{
+
+   /** The navigational state. */
+   private StateString navigationalState;
+
+   /** The instance displayed. */
+   private Instance instance;
+
+   public InvokePortletRenderCommand(StateString navigationalState)
+   {
+      this.navigationalState = navigationalState;
+   }
+
+   protected void create() throws ControllerException
+   {
+      InstanceContainer container = context.getController().getInstanceContainer();
+
+      String instanceId = "UserPortletInstance";
+
+      //
+      if (instanceId == null)
+      {
+         throw new ControllerException("No portlet instance configured on the configurator");
+      }
+
+      //
+      instance = container.getInstance(instanceId);
+      if (instance == null)
+      {
+         throw new ControllerException("Configurator portlet instance " + instanceId + " not found");
+      }
+   }
+
+
+   public StateString getNavigationalState()
+   {
+      return navigationalState;
+   }
+
+   public CommandInfo getInfo()
+   {
+      return null;
+   }
+
+   public Object execute() throws ControllerException
+   {
+      try
+      {
+         PortletContextFactory pcf1 = new PortletContextFactory(context);
+         PortletCommandFactory pcf2 = new PortletCommandFactoryImpl();
+         RenderInvocation render = PortletInvocationFactory.createRender(context, Mode.VIEW, WindowState.MAXIMIZED, navigationalState, pcf1, pcf2);
+         PortletInvocationResponse response = instance.invoke(render);
+
+         // For now let the controller handle non fragment response
+         String content = "";
+         if (response instanceof FragmentResponse)
+         {
+            content = ((FragmentResponse)response).getContent();
+         }
+         else if (response instanceof ErrorResponse)
+         {
+            content = ((ErrorResponse)response).toHTML();
+         }
+         else
+         {
+            throw new NotYetImplemented();
+         }
+
+         //
+         PageService ps = context.getController().getPageService();
+         LayoutService ls = ps.getLayoutService();
+         PortalLayout layout = ls.getLayout("generic", true);
+         Map pageProperties = new HashMap();
+         Map portalProperties = new HashMap();
+         portalProperties.put("theme.renderSetId", "divRenderer");
+         portalProperties.put("theme.id", "renaissance");
+         portalProperties.put("layout.strategyId", "maximizedRegion");
+         ModifiablePageResult result = new ModifiablePageResult("BILTO", pageProperties, portalProperties);
+
+         //
+         Map windowProps = new HashMap();
+         windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
+         windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
+         windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
+
+         //
+         WindowResult res = new ModifiableWindowResult("", content, Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+         WindowContext blah = new WindowContext("BILTO", "BILTO", "maximized", 0);
+         result.addWindowContext(blah);
+         result.addWindowResult("BILTO", res);
+
+         //
+         PageNavigationalState pns = new PageNavigationalState();
+         HashMap tmp = new HashMap();
+         tmp.put("BILTO", blah);
+         pns.initialize(tmp);
+         pns.setLayoutURI("/layouts/generic/maximized.jsp");
+         pns.setLayoutState("maximized");
+
+         //
+         return new PageRendition(layout, pns, result, ps);
+      }
+      catch (PortletInvokerException e)
+      {
+         return new ControllerException(e);
+      }
+   }
+}

Added: trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.ui.configurator;
+
+import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletCommandFactoryImpl implements PortletCommandFactory
+{
+   public ControllerCommand createInvokeActionCommand(ActionURL portletURL)
+   {
+      return new InvokePortletActionCommand(portletURL.getNavigationalState(), portletURL.getInteractionState(), null);
+   }
+
+   public ControllerCommand createInvokeRenderCommand(RenderURL portletURL)
+   {
+      return new InvokePortletRenderCommand(portletURL.getNavigationalState());
+   }
+}

Deleted: trunk/core/src/main/org/jboss/portal/core/ui/configurator/RenderPortletCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/configurator/RenderPortletCommand.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/main/org/jboss/portal/core/ui/configurator/RenderPortletCommand.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -1,86 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, 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.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.portlet.StateString;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RenderPortletCommand extends ControllerCommand
-{
-
-   /** The instance id. */
-   private String instanceId;
-
-   /** The navigational state. */
-   private StateString navigationalState;
-
-   /** The instance displayed. */
-   private Instance instance;
-
-   public RenderPortletCommand(String instanceId, StateString navigationalState)
-   {
-      this.instanceId = instanceId;
-      this.navigationalState = navigationalState;
-   }
-
-   public RenderPortletCommand(StateString navigationalState)
-   {
-      this.navigationalState = navigationalState;
-   }
-
-   protected void create() throws ControllerException
-   {
-      InstanceContainer container = context.getController().getInstanceContainer();
-      instance = container.getInstance(instanceId);
-
-      //
-      if (instance == null)
-      {
-         // Do smth clever
-      }
-   }
-
-   public CommandInfo getInfo()
-   {
-      return null;
-   }
-
-   public Object execute() throws ControllerException
-   {
-//      ControllerRenderContext ctx = new ControllerRenderContext(
-//         context,
-//         context.getServerInvocation().getServerContext(),
-//      );
-
-
-      return null;
-   }
-}

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-11-08 16:24:52 UTC (rev 5601)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2006-11-08 17:25:19 UTC (rev 5602)
@@ -686,6 +686,27 @@
          optional-attribute-name="DelegateFactory"
          proxy-type="attribute">portal:commandFactory=Dashboard</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.core.ui.configurator.ConfiguratorCommandFactory"
+      name="portal:commandFactory=Configurator"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+   </mbean>
+   <mbean
+      code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+      name="portal:commandFactory=Delegate,path=configure"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="Path">/configure</attribute>
+      <depends
+         optional-attribute-name="DelegatingFactory"
+         proxy-type="attribute">portal:commandFactory=Delegating</depends>
+      <depends
+         optional-attribute-name="DelegateFactory"
+         proxy-type="attribute">portal:commandFactory=Configurator</depends>
+   </mbean>
 
    <!-- URL factories -->
    <mbean
@@ -730,6 +751,17 @@
          optional-attribute-name="Factory"
          proxy-type="attribute">portal:urlFactory=Delegating</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.core.ui.configurator.ConfiguratorURLFactory"
+      name="portal:urlFactory=Configurator"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="Path">/configure</attribute>
+      <depends
+         optional-attribute-name="Factory"
+         proxy-type="attribute">portal:urlFactory=Delegating</depends>
+   </mbean>
 
    <!-- The federating portlet invoker -->
    <mbean

Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/PortletRequestDecoder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/PortletRequestDecoder.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/PortletRequestDecoder.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -1,320 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, 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;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * This class is a possible implementation for the behavior of a request made to a portlet. Which means that this
- * implementation does not preclude other implementations.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletRequestDecoder
-{
-
-   /** The mask for action. */
-   public static final int ACTION_MASK = 0x00000001;
-
-   /** The mask for render. */
-   public static final int RENDER_MASK = 0x00000002;
-
-   /** The mask for mode. */
-   public static final int MODE_MASK = 0x00000004;
-
-   /** The mask for window state. */
-   public static final int WINDOW_STATE_MASK = 0x00000008;
-
-   /** The mask for opacity. */
-   public static final int OPAQUE_MASK = 0x00000010;
-
-   /** The name of the URL parameter containing the mode. */
-   public static final String MODE_PARAMETER = "mode";
-
-   /** The name of the URL parameter containing the window state. */
-   public static final String WINDOW_STATE_PARAMETER = "windowstate";
-
-   /** The name of the URL parameter containing the interaction state. */
-   public static final String INTERACTION_STATE_PARAMETER = "is";
-
-   /** The name of the URL parameter containing the navigational state. */
-   public static final String NAVIGATIONAL_STATE_PARAMETER = "ns";
-
-   /** The name of the URL parameter containing the meta information. */
-   public static final String META_PARAMETER = "action";
-
-   /** . */
-   public static final int ACTION_TYPE = 0;
-
-   /** . */
-   public static final int RENDER_TYPE = 1;
-
-   /** . */
-   public static final int NAV_TYPE = 2;
-
-   /** . */
-   private Mode mode;
-
-   /** . */
-   private WindowState windowState;
-
-   /** . */
-   private StateString navigationalstate;
-
-   /** . */
-   private StateString interactionState;
-
-   /** . */
-   private Parameters form;
-
-   /** . */
-   private int type;
-
-   public void decode(Map queryParams, Map bodyParams) throws IllegalArgumentException
-   {
-      // The meta info from the URL
-      int meta = 0;
-      String[] metaParam = (String[])queryParams.get(META_PARAMETER);
-      if (metaParam != null)
-      {
-         try
-         {
-            meta = Integer.parseInt(metaParam[0], 16);
-         }
-         catch (NumberFormatException ignore)
-         {
-            // If mask is not present then we assume that it can only be a navigation URL (NAV_TYPE)
-         }
-      }
-
-      //
-      if ((meta & (ACTION_MASK | RENDER_MASK)) != 0)
-      {
-         // Check validity
-         if ((meta & (ACTION_MASK | RENDER_MASK)) == (ACTION_MASK | RENDER_MASK))
-         {
-            throw new IllegalArgumentException("Cannot have both action and render in the mask at the same time");
-         }
-
-         //
-         if ((meta & ACTION_MASK) != 0)
-         {
-            type = ACTION_TYPE;
-         }
-         else
-         {
-            type = RENDER_TYPE;
-         }
-
-         // Get the mode from the parameters if it exists
-         if ((meta & MODE_MASK) != 0)
-         {
-            String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
-            if (modeParam == null)
-            {
-               throw new IllegalArgumentException();
-            }
-            mode = Mode.create(modeParam[0]);
-         }
-         else
-         {
-            mode = null;
-         }
-
-         // Get the window state from the parameters if it exists
-         if ((meta & WINDOW_STATE_MASK) != 0)
-         {
-            String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
-            if (windowStateParam == null)
-            {
-               throw new IllegalArgumentException();
-            }
-            windowState = WindowState.create(windowStateParam[0]);
-         }
-         else
-         {
-            windowState = null;
-         }
-
-         //
-         boolean opaque = (meta & OPAQUE_MASK) != 0;
-         if (!opaque)
-         {
-            // Compute the parameters skipping the portlet navigational state that may be encoded as well
-            ParametersStateString query = new ParametersStateString();
-            for (Iterator i = queryParams.entrySet().iterator(); i.hasNext();)
-            {
-               Map.Entry entry = (Map.Entry)i.next();
-               int index = 0;
-               String name = (String)entry.getKey();
-               String[] queryValues = (String[])entry.getValue();
-
-               //
-               if (META_PARAMETER.equals(name))
-               {
-                  index = 1;
-               }
-               else if ((meta & MODE_MASK) != 0 && MODE_PARAMETER.equals(name))
-               {
-                  index = 1;
-               }
-               else if ((meta & WINDOW_STATE_MASK) != 0 && WINDOW_STATE_PARAMETER.equals(name))
-               {
-                  index = 1;
-               }
-
-               // We have interaction param(s) in the query string
-               if (index < queryValues.length)
-               {
-                  String[] values = new String[queryValues.length - index];
-                  System.arraycopy(queryValues, index, values, 0, values.length);
-                  query.setValues(name, values);
-               }
-            }
-
-            // Julien :
-            Parameters form = new Parameters();
-            if (bodyParams != null)
-            {
-               form.putAll(bodyParams);
-            }
-
-            //
-            if (type == ACTION_TYPE)
-            {
-               this.navigationalstate = null;
-               this.interactionState = query;
-               this.form = form;
-            }
-            else
-            {
-               this.navigationalstate = query;
-               this.interactionState = null;
-               this.form = null;
-            }
-         }
-         else
-         {
-            // Decode the navigational state
-            String[] ns = (String[])queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
-            if (ns != null)
-            {
-               navigationalstate = new OpaqueStateString(ns[0]);
-            }
-            else
-            {
-               navigationalstate = null;
-            }
-
-            // Decode more if we have an action
-            if (type == ACTION_TYPE)
-            {
-               // Decode the interaction state
-               String[] is = (String[])queryParams.get(INTERACTION_STATE_PARAMETER);
-               if (is != null)
-               {
-                  interactionState = new OpaqueStateString(is[0]);
-               }
-               else
-               {
-                  interactionState = null;
-               }
-
-               //
-               form = new Parameters();
-               if (bodyParams != null)
-               {
-                  form.putAll(bodyParams);
-               }
-            }
-            else
-            {
-               interactionState = null;
-               form = null;
-            }
-         }
-      }
-      else
-      {
-         // Set to nav type
-         type = NAV_TYPE;
-
-         // Get the mode from the parameters if it exists
-         String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
-         if (modeParam != null)
-         {
-            mode = Mode.create(modeParam[0]);
-         }
-         else
-         {
-            mode = null;
-         }
-
-         // Get the window state from the parameters if it exists
-         String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
-         if (windowStateParam != null)
-         {
-            windowState = WindowState.create(windowStateParam[0]);
-         }
-         else
-         {
-            windowState = null;
-         }
-      }
-   }
-
-   public Mode getMode()
-   {
-      return mode;
-   }
-
-   public WindowState getWindowState()
-   {
-      return windowState;
-   }
-
-   public StateString getNavigationalstate()
-   {
-      return navigationalstate;
-   }
-
-   public StateString getInteractionState()
-   {
-      return interactionState;
-   }
-
-   public Parameters getForm()
-   {
-      return form;
-   }
-
-   public int getType()
-   {
-      return type;
-   }
-}

Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java (from rev 5598, trunk/portlet/src/main/org/jboss/portal/portlet/PortletRequestDecoder.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/PortletRequestDecoder.java	2006-11-08 03:19:54 UTC (rev 5598)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,324 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.OpaqueStateString;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * This class is a possible implementation for the behavior of a request made to a portlet. Which means that this
+ * implementation does not preclude other implementations.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletRequestDecoder
+{
+
+   /** The mask for action. */
+   public static final int ACTION_MASK = 0x00000001;
+
+   /** The mask for render. */
+   public static final int RENDER_MASK = 0x00000002;
+
+   /** The mask for mode. */
+   public static final int MODE_MASK = 0x00000004;
+
+   /** The mask for window state. */
+   public static final int WINDOW_STATE_MASK = 0x00000008;
+
+   /** The mask for opacity. */
+   public static final int OPAQUE_MASK = 0x00000010;
+
+   /** The name of the URL parameter containing the mode. */
+   public static final String MODE_PARAMETER = "mode";
+
+   /** The name of the URL parameter containing the window state. */
+   public static final String WINDOW_STATE_PARAMETER = "windowstate";
+
+   /** The name of the URL parameter containing the interaction state. */
+   public static final String INTERACTION_STATE_PARAMETER = "is";
+
+   /** The name of the URL parameter containing the navigational state. */
+   public static final String NAVIGATIONAL_STATE_PARAMETER = "ns";
+
+   /** The name of the URL parameter containing the meta information. */
+   public static final String META_PARAMETER = "action";
+
+   /** . */
+   public static final int ACTION_TYPE = 0;
+
+   /** . */
+   public static final int RENDER_TYPE = 1;
+
+   /** . */
+   public static final int NAV_TYPE = 2;
+
+   /** . */
+   private Mode mode;
+
+   /** . */
+   private WindowState windowState;
+
+   /** . */
+   private StateString navigationalstate;
+
+   /** . */
+   private StateString interactionState;
+
+   /** . */
+   private Parameters form;
+
+   /** . */
+   private int type;
+
+   public void decode(Map queryParams, Map bodyParams) throws IllegalArgumentException
+   {
+      // The meta info from the URL
+      int meta = 0;
+      String[] metaParam = (String[])queryParams.get(META_PARAMETER);
+      if (metaParam != null)
+      {
+         try
+         {
+            meta = Integer.parseInt(metaParam[0], 16);
+         }
+         catch (NumberFormatException ignore)
+         {
+            // If mask is not present then we assume that it can only be a navigation URL (NAV_TYPE)
+         }
+      }
+
+      //
+      if ((meta & (ACTION_MASK | RENDER_MASK)) != 0)
+      {
+         // Check validity
+         if ((meta & (ACTION_MASK | RENDER_MASK)) == (ACTION_MASK | RENDER_MASK))
+         {
+            throw new IllegalArgumentException("Cannot have both action and render in the mask at the same time");
+         }
+
+         //
+         if ((meta & ACTION_MASK) != 0)
+         {
+            type = ACTION_TYPE;
+         }
+         else
+         {
+            type = RENDER_TYPE;
+         }
+
+         // Get the mode from the parameters if it exists
+         if ((meta & MODE_MASK) != 0)
+         {
+            String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+            if (modeParam == null)
+            {
+               throw new IllegalArgumentException();
+            }
+            mode = Mode.create(modeParam[0]);
+         }
+         else
+         {
+            mode = null;
+         }
+
+         // Get the window state from the parameters if it exists
+         if ((meta & WINDOW_STATE_MASK) != 0)
+         {
+            String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+            if (windowStateParam == null)
+            {
+               throw new IllegalArgumentException();
+            }
+            windowState = WindowState.create(windowStateParam[0]);
+         }
+         else
+         {
+            windowState = null;
+         }
+
+         //
+         boolean opaque = (meta & OPAQUE_MASK) != 0;
+         if (!opaque)
+         {
+            // Compute the parameters skipping the portlet navigational state that may be encoded as well
+            ParametersStateString query = new ParametersStateString();
+            for (Iterator i = queryParams.entrySet().iterator(); i.hasNext();)
+            {
+               Map.Entry entry = (Map.Entry)i.next();
+               int index = 0;
+               String name = (String)entry.getKey();
+               String[] queryValues = (String[])entry.getValue();
+
+               //
+               if (META_PARAMETER.equals(name))
+               {
+                  index = 1;
+               }
+               else if ((meta & MODE_MASK) != 0 && MODE_PARAMETER.equals(name))
+               {
+                  index = 1;
+               }
+               else if ((meta & WINDOW_STATE_MASK) != 0 && WINDOW_STATE_PARAMETER.equals(name))
+               {
+                  index = 1;
+               }
+
+               // We have interaction param(s) in the query string
+               if (index < queryValues.length)
+               {
+                  String[] values = new String[queryValues.length - index];
+                  System.arraycopy(queryValues, index, values, 0, values.length);
+                  query.setValues(name, values);
+               }
+            }
+
+            // Julien :
+            Parameters form = new Parameters();
+            if (bodyParams != null)
+            {
+               form.putAll(bodyParams);
+            }
+
+            //
+            if (type == ACTION_TYPE)
+            {
+               this.navigationalstate = null;
+               this.interactionState = query;
+               this.form = form;
+            }
+            else
+            {
+               this.navigationalstate = query;
+               this.interactionState = null;
+               this.form = null;
+            }
+         }
+         else
+         {
+            // Decode the navigational state
+            String[] ns = (String[])queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
+            if (ns != null)
+            {
+               navigationalstate = new OpaqueStateString(ns[0]);
+            }
+            else
+            {
+               navigationalstate = null;
+            }
+
+            // Decode more if we have an action
+            if (type == ACTION_TYPE)
+            {
+               // Decode the interaction state
+               String[] is = (String[])queryParams.get(INTERACTION_STATE_PARAMETER);
+               if (is != null)
+               {
+                  interactionState = new OpaqueStateString(is[0]);
+               }
+               else
+               {
+                  interactionState = null;
+               }
+
+               //
+               form = new Parameters();
+               if (bodyParams != null)
+               {
+                  form.putAll(bodyParams);
+               }
+            }
+            else
+            {
+               interactionState = null;
+               form = null;
+            }
+         }
+      }
+      else
+      {
+         // Set to nav type
+         type = NAV_TYPE;
+
+         // Get the mode from the parameters if it exists
+         String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+         if (modeParam != null)
+         {
+            mode = Mode.create(modeParam[0]);
+         }
+         else
+         {
+            mode = null;
+         }
+
+         // Get the window state from the parameters if it exists
+         String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+         if (windowStateParam != null)
+         {
+            windowState = WindowState.create(windowStateParam[0]);
+         }
+         else
+         {
+            windowState = null;
+         }
+      }
+   }
+
+   public Mode getMode()
+   {
+      return mode;
+   }
+
+   public WindowState getWindowState()
+   {
+      return windowState;
+   }
+
+   public StateString getNavigationalstate()
+   {
+      return navigationalstate;
+   }
+
+   public StateString getInteractionState()
+   {
+      return interactionState;
+   }
+
+   public Parameters getForm()
+   {
+      return form;
+   }
+
+   public int getType()
+   {
+      return type;
+   }
+}


Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,147 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.server.ServerURL;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletRequestEncoder
+{
+
+   public static void encodeAction(ServerURL url, StateString navigationalState, StateString interactionState, Mode mode, WindowState windowState)
+   {
+      int meta = PortletRequestDecoder.ACTION_MASK;
+
+      //
+      if (interactionState != null)
+      {
+         if (interactionState instanceof ParametersStateString)
+         {
+            if (navigationalState != null)
+            {
+               throw new IllegalArgumentException("Cannot handle case with both non opaque interaction and navigational state");
+            }
+
+            // Add the parameters
+            Parameters parameters = ((ParametersStateString)interactionState).getParameters();
+            configure(url, parameters);
+         }
+         else
+         {
+            meta |= PortletRequestDecoder.OPAQUE_MASK;
+
+            // Set interaction state
+            url.setParameterValue(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, interactionState.getStringValue());
+
+            // We may have navigational state
+            if (navigationalState != null)
+            {
+               url.setParameterValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+            }
+         }
+      }
+
+      //
+      configure(meta, url, mode, windowState);
+   }
+
+   public static void encodeRender(ServerURL url, StateString navigationalState, Mode mode, WindowState windowState)
+   {
+      int meta = PortletRequestDecoder.RENDER_MASK;
+
+      //
+      if (navigationalState != null)
+      {
+         if (navigationalState instanceof ParametersStateString)
+         {
+            // Add the parameters
+            Parameters parameters = ((ParametersStateString)navigationalState).getParameters();
+            configure(url, parameters);
+         }
+         else
+         {
+            meta |= PortletRequestDecoder.OPAQUE_MASK;
+
+            //
+            url.setParameterValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+         }
+      }
+
+      //
+      configure(meta, url, mode, windowState);
+   }
+
+   private static void configure(ServerURL url, Parameters parameters)
+   {
+      for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
+      {
+         Map.Entry entry = (Map.Entry)i.next();
+         String name = (String)entry.getKey();
+         String[] values = (String[])entry.getValue();
+         url.setParameterValues(name, values);
+      }
+   }
+
+   private static void configure(int meta, ServerURL url, Mode mode, WindowState windowState)
+   {
+      if (mode != null)
+      {
+         meta |= PortletRequestDecoder.MODE_MASK;
+         setMetaParameter(url, PortletRequestDecoder.MODE_PARAMETER, mode.toString());
+      }
+      if (windowState != null)
+      {
+         meta |= PortletRequestDecoder.WINDOW_STATE_MASK;
+         setMetaParameter(url, PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
+      }
+      setMetaParameter(url, PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
+   }
+
+   private static void setMetaParameter(ServerURL serverURL, String name, String value)
+   {
+      String[] values = serverURL.getParameterValues(name);
+      if (values == null)
+      {
+         values = new String[]{value};
+      }
+      else
+      {
+         String[] tmp = new String[values.length + 1];
+         System.arraycopy(values, 0, tmp, 1, values.length);
+         tmp[0] = value;
+         values = tmp;
+      }
+      serverURL.setParameterValues(name, values);
+   }
+}

Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/AccessDeniedResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/AccessDeniedResponse.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/AccessDeniedResponse.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -1,31 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, 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.invocation.response;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class AccessDeniedResponse
-{
-}

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -384,4 +384,19 @@
          closed = true;
       }
    }
+
+   /**
+    * Return the content as a string.
+    */
+   public String getContent()
+   {
+      switch (getType())
+      {
+         case FragmentResponse.TYPE_CHARS:
+            return getChars().toString();
+         case FragmentResponse.TYPE_BYTES:
+            return getBytes().toString();
+      }
+      return "";
+   }
 }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientPrivilegesResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientPrivilegesResponse.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientPrivilegesResponse.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -26,6 +26,6 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class InsufficientPrivilegesResponse extends PortletInvocationResponse
+public class InsufficientPrivilegesResponse extends SecurityResponse
 {
 }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientTransportGuaranteeResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientTransportGuaranteeResponse.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/InsufficientTransportGuaranteeResponse.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -26,6 +26,6 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class InsufficientTransportGuaranteeResponse extends PortletInvocationResponse
+public class InsufficientTransportGuaranteeResponse extends SecurityResponse
 {
 }

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityErrorResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityErrorResponse.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityErrorResponse.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -26,11 +26,23 @@
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision$
  */
-public class SecurityErrorResponse
-   extends ErrorResponse
+public class SecurityErrorResponse extends SecurityResponse
 {
+
+   /** . */
+   private Throwable throwable;
+
    public SecurityErrorResponse(Throwable throwable)
    {
-      super(throwable);
+      if (throwable == null)
+      {
+         throw new IllegalArgumentException("There must be a throwable");
+      }
+      this.throwable = throwable;
    }
+
+   public Throwable getThrowable()
+   {
+      return throwable;
+   }
 }

Added: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityResponse.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/SecurityResponse.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.invocation.response;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SecurityResponse extends PortletInvocationResponse
+{
+}

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -36,7 +36,7 @@
 import org.jboss.portal.portlet.PortletContext;
 import org.jboss.portal.portlet.PortletInvoker;
 import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.PortletRequestDecoder;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
 import org.jboss.portal.portlet.PortletURL;
 import org.jboss.portal.portlet.RenderURL;
 import org.jboss.portal.portlet.StateEvent;

Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -28,7 +28,7 @@
 import org.jboss.portal.portlet.OpaqueStateString;
 import org.jboss.portal.portlet.Parameters;
 import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.PortletRequestDecoder;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
 
 import java.util.HashMap;
 import java.util.Map;

Modified: trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -22,10 +22,9 @@
  ******************************************************************************/
 package org.jboss.portal.server;
 
-import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.ParameterMap;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -35,32 +34,20 @@
 public class AbstractServerURL implements ServerURL
 {
 
+   /** . */
    private String portalRequestPath;
 
+   /** . */
    private Map parameters = new HashMap();
 
-   public void setParameterValue(String name, String value)
+   /** . */
+   private ParameterMap map = new ParameterMap()
    {
-      parameters.put(name, new AbstractParameter(name, value));
-   }
-
-   public void setParameterValues(String name, String[] values)
-   {
-      parameters.put(name, new AbstractParameter(name, values));
-   }
-
-   public String[] getParameterValues(String name)
-   {
-      AbstractParameter param = (AbstractParameter)parameters.get(name);
-      if (param != null)
+      protected Map getDelegate()
       {
-         return param.values;
+         return parameters;
       }
-      else
-      {
-         return null;
-      }
-   }
+   };
 
    public void setPortalRequestPath(String portalRequestPath)
    {
@@ -72,41 +59,45 @@
       return portalRequestPath;
    }
 
-   public Iterator getParameters()
+   public void setParameterValue(String name, String value)
    {
-      return parameters.values().iterator();
+      if (name == null)
+      {
+         throw new IllegalArgumentException();
+      }
+      if (value == null)
+      {
+         map.remove(name);
+      }
+      else
+      {
+         map.put(name, new String[]{value});
+      }
    }
 
-   private static class AbstractParameter implements Parameter
+   public void setParameterValues(String name, String[] values)
    {
-
-      /** . */
-      private String name;
-
-      /** . */
-      private String[] values;
-
-      public AbstractParameter(String name, String value)
+      if (name == null)
       {
-         this.name = name;
-         this.values = new String[]{value};
+         throw new IllegalArgumentException();
       }
-
-      public AbstractParameter(String name, String[] values)
+      if (values == null)
       {
-         this.name = name;
-         this.values = values;
+         map.remove(name);
       }
-
-      public String getName()
+      else
       {
-         return name;
+         map.put(name, values);
       }
+   }
 
-      public Iterator getValues()
-      {
-         return Tools.iterator(values);
-      }
+   public String[] getParameterValues(String name)
+   {
+      return (String[])map.get(name);
    }
 
+   public Map getParameterMap()
+   {
+      return map;
+   }
 }

Modified: trunk/server/src/main/org/jboss/portal/server/ServerURL.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerURL.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/server/src/main/org/jboss/portal/server/ServerURL.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -23,6 +23,7 @@
 package org.jboss.portal.server;
 
 import java.util.Iterator;
+import java.util.Map;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -38,21 +39,25 @@
    /**
     *
     */
-   Iterator getParameters();
+   void setPortalRequestPath(String portalRequestPath);
 
    /**
     *
     */
-   public interface Parameter
-   {
-      /**
-       *
-       */
-      String getName();
+   String[] getParameterValues(String name) throws IllegalArgumentException;
 
-      /**
-       *
-       */
-      Iterator getValues();
-   }
+   /**
+    *
+    */
+   void setParameterValue(String name, String value) throws IllegalArgumentException;
+
+   /**
+    *
+    */
+   void setParameterValues(String name, String[] values) throws IllegalArgumentException;
+
+   /**
+    *
+    */
+   Map getParameterMap();
 }

Modified: trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -517,13 +517,14 @@
 
          //
          boolean first = true;
-         for (Iterator i = url.getParameters(); i.hasNext();)
+         for (Iterator i = url.getParameterMap().entrySet().iterator(); i.hasNext();)
          {
-            ServerURL.Parameter parameter = (ServerURL.Parameter)i.next();
-            String name = parameter.getName();
-            for (Iterator j = parameter.getValues(); j.hasNext();)
+            Map.Entry parameter = (Map.Entry)i.next();
+            String name = (String)parameter.getKey();
+            String[] values = (String[])parameter.getValue();
+            for (int j = 0; j < values.length; j++)
             {
-               String value = (String)j.next();
+               String value = values[j];
                append(first ? "?" : "&");
                append(URLTools.encodeXWWWFormURL(name));
                append("=");

Modified: trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java	2006-11-08 16:24:52 UTC (rev 5601)
+++ trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java	2006-11-08 17:25:19 UTC (rev 5602)
@@ -57,17 +57,11 @@
 //   public void initialize(Map windowContexts, PageInitialStateProvider initialStateProvider)
    public void initialize(Map windowContexts)
    {
-      layoutState = null;
-      uri = null;
+      this.layoutState = null;
+      this.uri = null;
       this.windowContexts.clear();
       this.previousWindowContexts.clear();
-
-      for (Iterator i = windowContexts.keySet().iterator(); i.hasNext();)
-      {
-         String windowId = (String)i.next();
-         WindowContext windowContext = (WindowContext)windowContexts.get(windowId);
-         this.windowContexts.put(windowId, windowContext);
-      }
+      this.windowContexts.putAll(windowContexts);
    }
 
    public WindowContext getWindowContext(String windowId)




More information about the jboss-svn-commits mailing list