portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session NavigationalState.java
Date Wed, 31 Mar 2004 01:19:24 GMT
taylor      2004/03/30 17:19:24

  Modified:    portal/src/java/org/apache/jetspeed/engine/core
                        PortletActionProviderImpl.java
               portal/src/java/org/apache/jetspeed/engine/servlet
                        ServletRequestImpl.java
               portal/src/java/org/apache/jetspeed/request
                        JetspeedRequestContext.java
                        JetspeedRequestContextComponent.java
                        RequestContextComponent.java RequestContext.java
               portal/src/java/org/apache/jetspeed/engine
                        JetspeedServlet.java
               portal/src/java/org/apache/jetspeed/services/information
                        ResourceURLProviderImpl.java
                        DynamicInformationProviderImpl.java
                        PortletURLProviderImpl.java
               portal/src/java/org/apache/jetspeed/container/session/impl
                        PathNavigationalState.java
                        SessionNavigationalState.java
               portal/src/java/org/apache/jetspeed/aggregator/impl
                        BasicAggregator.java
               portal/src/java/org/apache/jetspeed/container
                        ContainerValve.java
               portal/src/java/org/apache/jetspeed/container/session
                        NavigationalState.java
  Added:       portal/src/java/org/apache/jetspeed/container/url
                        PortalURL.java
               portal/src/java/org/apache/jetspeed/container/url/impl
                        PortalControlParameter.java PortalURLImpl.java
  Removed:     portal/src/java/org/apache/jetspeed/engine/core
                        PortalURL.java PortalURLImpl.java
                        PortalControlParameter.java
  Log:
  completed refactoring of nav state and Urls
  Now ready to write a second impl of nav state
  
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/url/PortalURL.java
  
  Index: PortalURL.java
  ===================================================================
  /**
   * Created on Oct 21, 2003
   *
   * 
   * @author
   */
  package org.apache.jetspeed.container.url;
  
  import org.apache.jetspeed.container.url.impl.PortalControlParameter;
  import org.apache.jetspeed.request.RequestContext;
  
  /**
   * <p>
   * PortalURL
   * </p>
   * 
   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
   * @version $Id: PortalURL.java,v 1.1 2004/03/31 01:19:24 taylor Exp $
   *
   */
  public interface PortalURL
  {
      /** HTTP protocol. */
      public static final String HTTP = "http";
  
      /** HTTPS protocol. */
      public static final String HTTPS = "https";
  
      public abstract void init(RequestContext context);
      /**
       * Adds a navigational information pointing to a portal part, e.g. PageGroups
       * or Pages
       * 
       * @param nav    the string pointing to a portal part
       */
      //public abstract void addGlobalNavigation(String nav);
      /**
       * Sets the local navigation. Because the local navigation is always handled
       * by the Browser, therefore the local navigation cleared.
       */
      //public abstract void setLocalNavigation();
      /**
       * Adds a navigational information pointing to a local portal part inside
       * of a global portal part, e.g. a portlet on a page
       * 
       * @param nav    the string pointing to a local portal part
       */
      //public abstract void addLocalNavigation(String nav);
      /**
       * Returns true if the given string is part of the global navigation of this URL
       * 
       * @param nav    the string to check
       * @return true, if the string is part of the navigation
       */
      //public abstract boolean isPartOfGlobalNavigation(String nav);
      /**
       * Returns true if the given string is part of the local navigation of this URL
       * 
       * @param nav    the string to check
       * @return true, if the string is part of the navigation
       */
      //public abstract boolean isPartOfLocalNavigation(String nav);
      //public abstract String getGlobalNavigationAsString();
      //public abstract String getLocalNavigationAsString();
      //public abstract String getControlParameterAsString(PortalControlParameter controlParam);
      //public abstract String getRequestParameterAsString(PortalControlParameter controlParam);
      //public abstract String toString();
      public abstract String toString(PortalControlParameter controlParam, Boolean p_secure);
      // public abstract void analyzeControlInformation(PortalControlParameter control);
      // public abstract void setRenderParameter(PortletWindow portletWindow, String name, String[] values);
      // public abstract void clearRenderParameters(PortletWindow portletWindow);
      public abstract String getBaseURL();
      //public abstract String getContext();
  }
  
  
  1.6       +9 -6      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/core/PortletActionProviderImpl.java
  
  Index: PortletActionProviderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/core/PortletActionProviderImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PortletActionProviderImpl.java	30 Mar 2004 22:00:20 -0000	1.5
  +++ PortletActionProviderImpl.java	31 Mar 2004 01:19:24 -0000	1.6
  @@ -22,9 +22,10 @@
   
   import org.apache.pluto.om.window.PortletWindow;
   import org.apache.pluto.services.information.PortletActionProvider;
  +import org.apache.jetspeed.Jetspeed;
   import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.request.RequestContext;
  -import org.apache.jetspeed.request.JetspeedRequestContext;
  +import org.apache.jetspeed.request.RequestContextComponent;
   
   /**
    * Handle operations that the portlet may perform in an action method.
  @@ -38,20 +39,23 @@
       HttpServletRequest request = null;
       ServletConfig config = null;
       private PortletWindow portletWindow;
  -
  +    private RequestContext context;
  +    
       public PortletActionProviderImpl(HttpServletRequest request, ServletConfig config, PortletWindow portletWindow)
       {
           this.request = request;
           this.config = config;
           this.portletWindow = portletWindow;
  +        // TODO: assemble this
  +        RequestContextComponent rcc = (RequestContextComponent)Jetspeed.getComponentManager().getComponent(RequestContextComponent.class);
  +        this.context = rcc.getRequestContext(request);       
       }
   
       /* (non-Javadoc)
        * @see org.apache.pluto.services.information.PortletActionProvider#changePortletMode(PortletWindow, PortletMode)
        */
       public void changePortletMode(PortletMode mode)
  -    {
  -        RequestContext context = JetspeedRequestContext.getRequestContext(request);
  +    {        
           NavigationalState state = context.getNavigationalState();
           if (!(state.getMode(portletWindow).equals(mode)) && mode != null)
           {
  @@ -64,7 +68,6 @@
        */
       public void changePortletWindowState(WindowState state)
       {
  -        RequestContext context = JetspeedRequestContext.getRequestContext(request);
           NavigationalState navstate = context.getNavigationalState();
           if (!(navstate.getState(portletWindow).equals(state)) && state != null)
           {
  
  
  
  1.8       +1 -11     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestImpl.java
  
  Index: ServletRequestImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ServletRequestImpl.java	29 Mar 2004 04:51:48 -0000	1.7
  +++ ServletRequestImpl.java	31 Mar 2004 01:19:24 -0000	1.8
  @@ -17,15 +17,11 @@
   
   import java.util.Collections;
   import java.util.Enumeration;
  -import java.util.HashMap;
  -import java.util.Iterator;
   import java.util.Map;
   
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletRequestWrapper;
   
  -import org.apache.jetspeed.Jetspeed;
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
   import org.apache.pluto.om.window.PortletWindow;
   
   /**
  @@ -37,9 +33,6 @@
    */
   public class ServletRequestImpl extends HttpServletRequestWrapper
   {
  -
  -    PortalControlParameter control = null;
  -
       PortletWindow portletWindow = null;
   
       private Map portletParameters;
  @@ -49,9 +42,6 @@
           super(servletRequest);
   
           this.portletWindow = window;
  -        // control = new PortalControlParameter(new PortalURLImpl(servletRequest));
  -        control = new PortalControlParameter(Jetspeed.getCurrentRequestContext().getRequestedPortalURL());
  -
       }
   
       private HttpServletRequest _getHttpServletRequest()
  
  
  
  1.12      +1 -22     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
  
  Index: JetspeedRequestContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JetspeedRequestContext.java	30 Mar 2004 22:00:19 -0000	1.11
  +++ JetspeedRequestContext.java	31 Mar 2004 01:19:24 -0000	1.12
  @@ -31,8 +31,6 @@
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.container.session.NavigationalStateComponent;
  -import org.apache.jetspeed.engine.core.PortalURL;
  -import org.apache.jetspeed.engine.core.PortalURLImpl;
   import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
   import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
   import org.apache.pluto.om.window.PortletWindow;
  @@ -63,7 +61,6 @@
       private String mimeType;
       private String mediaType;
       private NavigationalState navstate;
  -    private PortalURL requestedPortalURL;
       private PortletWindow actionWindow;
       private String encoding;
       
  @@ -92,7 +89,6 @@
           {
               this.request.setAttribute(REQUEST_PORTALENV, this);
           }
  -        requestedPortalURL = new PortalURLImpl(this);
           
           if (navcomponent != null)
           {
  @@ -105,18 +101,6 @@
       {
       }
   
  -    /**
  -     * The servlet request can always get you back to the Request Context if you need it
  -     * This static accessor provides this capability
  -     *
  -     * @param request
  -     * @return RequestContext
  -     */
  -    public static RequestContext getRequestContext(HttpServletRequest request)
  -    {
  -        return (RequestContext) request.getAttribute(REQUEST_PORTALENV);
  -    }
  -
       public HttpServletRequest getRequest()
       {
           return request;
  @@ -228,11 +212,6 @@
           return navstate;
       }
       
  -    public PortalURL getRequestedPortalURL()
  -    {
  -        return requestedPortalURL;
  -    }
  -
       /**
        * Get the target Portlet Action Window
        *
  
  
  
  1.2       +13 -1     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
  
  Index: JetspeedRequestContextComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JetspeedRequestContextComponent.java	30 Mar 2004 22:00:19 -0000	1.1
  +++ JetspeedRequestContextComponent.java	31 Mar 2004 01:19:24 -0000	1.2
  @@ -79,5 +79,17 @@
       public void release(RequestContext context) 
       {
       }
  +
  +    /**
  +     * The servlet request can always get you back to the Request Context if you need it
  +     * This static accessor provides this capability
  +     *
  +     * @param request
  +     * @return RequestContext
  +     */
  +    public RequestContext getRequestContext(HttpServletRequest request)
  +    {
  +        return (RequestContext) request.getAttribute(JetspeedRequestContext.REQUEST_PORTALENV);
  +    }
       
   }
  
  
  
  1.2       +10 -1     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContextComponent.java
  
  Index: RequestContextComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContextComponent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestContextComponent.java	30 Mar 2004 22:00:19 -0000	1.1
  +++ RequestContextComponent.java	31 Mar 2004 01:19:24 -0000	1.2
  @@ -45,4 +45,13 @@
        */
       void release(RequestContext context);
       
  +    /**
  +     * The servlet request can always get you back to the Request Context if you need it
  +     * This static accessor provides this capability
  +     *
  +     * @param request
  +     * @return RequestContext
  +     */
  +    RequestContext getRequestContext(HttpServletRequest request);    
  +    
   }
  
  
  
  1.10      +1 -9      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContext.java
  
  Index: RequestContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContext.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RequestContext.java	30 Mar 2004 22:00:19 -0000	1.9
  +++ RequestContext.java	31 Mar 2004 01:19:24 -0000	1.10
  @@ -26,7 +26,6 @@
   import org.apache.jetspeed.aggregator.ContentDispatcher;
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.container.session.NavigationalState;
  -import org.apache.jetspeed.engine.core.PortalURL;
   import org.apache.jetspeed.profiler.ProfileLocator;
   import org.apache.jetspeed.om.page.Page;
   import org.apache.pluto.om.window.PortletWindow;
  @@ -154,13 +153,6 @@
        */
       public NavigationalState getNavigationalState();
       
  -    /**
  -     * Get the requested Portlet URL for this request
  -     *
  -     * @return PortletURL the requested Portlet URL
  -     */
  -    public PortalURL getRequestedPortalURL();
  -
       /**
        * Get the target Action Window
        *
  
  
  
  1.6       +1 -2      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedServlet.java
  
  Index: JetspeedServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JetspeedServlet.java	30 Mar 2004 22:00:20 -0000	1.5
  +++ JetspeedServlet.java	31 Mar 2004 01:19:24 -0000	1.6
  @@ -202,7 +202,6 @@
                   init(req, res);
               }
   
  -            //RequestContext context = RequestContextFactory.getInstance(req, res, getServletConfig());
               RequestContextComponent contextComponent = (RequestContextComponent)Jetspeed.getComponentManager().getComponent(RequestContextComponent.class);
               RequestContext context = contextComponent.create(req, res, getServletConfig());
               engine.service(context);
  
  
  
  1.3       +5 -4      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/information/ResourceURLProviderImpl.java
  
  Index: ResourceURLProviderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/information/ResourceURLProviderImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResourceURLProviderImpl.java	8 Mar 2004 00:35:26 -0000	1.2
  +++ ResourceURLProviderImpl.java	31 Mar 2004 01:19:24 -0000	1.3
  @@ -18,7 +18,7 @@
   import java.net.MalformedURLException;
   import java.net.URL;
   
  -import org.apache.jetspeed.Jetspeed;
  +import org.apache.jetspeed.request.RequestContext;
   import org.apache.pluto.om.window.PortletWindow;
   import org.apache.pluto.services.information.ResourceURLProvider;
   
  @@ -38,12 +38,13 @@
       private PortletWindow portletWindow = null;
       private String stringUrl = "";
       private String base = "";
  +    private RequestContext context;
   
  -    public ResourceURLProviderImpl(DynamicInformationProviderImpl provider, PortletWindow portletWindow)
  +    public ResourceURLProviderImpl(RequestContext context, PortletWindow portletWindow)
       {
           this.portletWindow = portletWindow;
  -        // this.base = PortalEnvironment.getPortalEnvironment(provider.request).getRequestedPortalURL().getBaseURLexcludeContext();
  -        this.base = Jetspeed.getCurrentRequestContext().getRequestedPortalURL().getBaseURL();
  +        this.context = context;                
  +        this.base = context.getNavigationalState().getBaseURL();
       }
   
       // ResourceURLProvider implementation.
  
  
  
  1.4       +22 -19    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java
  
  Index: DynamicInformationProviderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DynamicInformationProviderImpl.java	8 Mar 2004 00:35:26 -0000	1.3
  +++ DynamicInformationProviderImpl.java	31 Mar 2004 01:19:24 -0000	1.4
  @@ -32,11 +32,10 @@
   import org.apache.pluto.om.window.PortletWindow;
   import org.apache.pluto.util.NamespaceMapperAccess;
   import org.apache.pluto.services.information.PortletURLProvider;
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
  -import org.apache.jetspeed.engine.core.PortalURL;
  +import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.engine.core.PortletActionProviderImpl;
  -import org.apache.jetspeed.request.JetspeedRequestContext;
   import org.apache.jetspeed.request.RequestContext;
  +import org.apache.jetspeed.request.RequestContextComponent;
   import org.apache.jetspeed.Jetspeed;
   
   /**
  @@ -64,17 +63,17 @@
       HttpServletRequest request = null;
       ServletConfig config = null;
   
  -    PortalURL currentURL = null;
  -    PortalControlParameter control = null;
  -
  +    RequestContext context;
  +    
       public DynamicInformationProviderImpl(HttpServletRequest request,
                                             ServletConfig config)
       {
           this.request = request;
           this.config = config;
           
  -        currentURL = JetspeedRequestContext.getRequestContext(request).getRequestedPortalURL();
  -        control = new PortalControlParameter(currentURL);
  +        // TODO: assemble this dependency when this provider is converted to a component
  +        RequestContextComponent rcc = (RequestContextComponent)Jetspeed.getComponentManager().getComponent(RequestContextComponent.class);
  +        this.context = rcc.getRequestContext(request);
       }
   
       public PortletURLProvider getPortletURLProvider(PortletWindow portletWindow)
  @@ -85,13 +84,11 @@
   
        public String getRequestContentType()
        {
  -         RequestContext context = JetspeedRequestContext.getRequestContext(this.request);
            return context.getMimeType().toString();
        }
   
        public String getResponseContentType()
        {
  -         RequestContext context = JetspeedRequestContext.getRequestContext(this.request);
            return context.getMimeType().toString();
        }
   
  @@ -106,22 +103,26 @@
   
        public PortletMode getPortletMode(PortletWindow portletWindow)
        {
  -         return control.getMode(portletWindow);
  +         NavigationalState navState = context.getNavigationalState();
  +         return navState.getMode(portletWindow);
        }
   
        public PortletMode getPreviousPortletMode(PortletWindow portletWindow)
        {
  -         return control.getPrevMode(portletWindow);
  +         NavigationalState navState = context.getNavigationalState();         
  +         return navState.getPreviousMode(portletWindow);
        }
   
        public WindowState getWindowState(PortletWindow portletWindow)
        {
  -         return control.getState(portletWindow);
  +         NavigationalState navState = context.getNavigationalState();         
  +         return navState.getState(portletWindow);
        }
   
        public WindowState getPreviousWindowState(PortletWindow portletWindow)
        {
  -         return control.getPrevState(portletWindow);
  +         NavigationalState navState = context.getNavigationalState();         
  +         return navState.getPreviousState(portletWindow);
        }
       public boolean isPortletModeAllowed(PortletMode mode)
       {
  @@ -181,7 +182,7 @@
   
       public String getBasePortalURL()
       {
  -         return currentURL.getBaseURL();
  +         return context.getNavigationalState().getBaseURL();
       }
   
       public Map getAllParameters(PortletWindow portletWindow)
  @@ -202,12 +203,14 @@
               }
           }
   
  -        Iterator iterator = control.getRenderParamNames(portletWindow);
  +        NavigationalState navState = context.getNavigationalState();
  +        
  +        Iterator iterator = navState.getRenderParamNames(portletWindow);
           while (iterator.hasNext())
           {
               String name = (String)iterator.next();
   
  -            String[] values = control.getRenderParamValues(portletWindow, name);
  +            String[] values = navState.getRenderParamValues(portletWindow, name);
   
               portletParameters.put(name, values );
   
  @@ -245,7 +248,7 @@
       public ResourceURLProvider getResourceURLProvider(PortletWindow window)
       {
           
  -        return new ResourceURLProviderImpl(this, window);
  +        return new ResourceURLProviderImpl(this.context, window);
       }
   
   }
  
  
  
  1.5       +24 -20    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/information/PortletURLProviderImpl.java
  
  Index: PortletURLProviderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/information/PortletURLProviderImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletURLProviderImpl.java	8 Mar 2004 00:35:26 -0000	1.4
  +++ PortletURLProviderImpl.java	31 Mar 2004 01:19:24 -0000	1.5
  @@ -21,9 +21,11 @@
   import javax.portlet.PortletMode;
   import javax.portlet.WindowState;
   
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
  -import org.apache.jetspeed.engine.core.PortalURL;
  -import org.apache.jetspeed.request.JetspeedRequestContext;
  +import org.apache.jetspeed.Jetspeed;
  +import org.apache.jetspeed.container.session.NavigationalState;
  +import org.apache.jetspeed.container.session.NavigationalStateComponent;
  +import org.apache.jetspeed.request.RequestContext;
  +import org.apache.jetspeed.request.RequestContextComponent;
   import org.apache.pluto.om.window.PortletWindow;
   import org.apache.pluto.services.information.PortletURLProvider;
   import org.apache.pluto.util.NamespaceMapperAccess;
  @@ -46,14 +48,20 @@
       private boolean clearParameters = false;
       private Map parameters = null;
   
  -    private PortalURL portalUrl;
  -    private PortalControlParameter controlURL;
  +    private RequestContext context;
  +    private NavigationalState nav;
  +    
       public PortletURLProviderImpl(DynamicInformationProviderImpl provider, PortletWindow portletWindow)
       {
           this.provider = provider;
           this.portletWindow = portletWindow;
  -        portalUrl = JetspeedRequestContext.getRequestContext(provider.request).getRequestedPortalURL();
  -        controlURL = new PortalControlParameter(portalUrl);
  +        
  +        // TODO: assemble this with factory
  +        RequestContextComponent rcc = (RequestContextComponent)Jetspeed.getComponentManager().getComponent(RequestContextComponent.class);
  +        NavigationalStateComponent nsc = (NavigationalStateComponent)Jetspeed.getComponentManager().getComponent(NavigationalStateComponent.class);
  +        
  +        context = rcc.getRequestContext(provider.request);
  +        nav = nsc.create(context);
       }
   
       public void setPortletMode(PortletMode mode)
  @@ -77,10 +85,8 @@
       }
   
       public void clearParameters()
  -    {
  -
  -        controlURL.clearRenderParameters(portletWindow);
  -
  +    {        
  +        nav.clearRenderParameters(portletWindow);
       }
   
       public void setParameters(Map parameters)
  @@ -90,15 +96,14 @@
   
       public String toString()
       {
  -
           if (mode != null)
           {
  -            controlURL.setMode(portletWindow, mode);
  +            nav.setMode(portletWindow, mode);
           }
   
           if (state != null)
           {
  -            controlURL.setState(portletWindow, state);
  +            nav.setState(portletWindow, state);
           }
   
           // STW: Spec reference PLT:12:2
  @@ -111,7 +116,7 @@
   
           if (action)
           {
  -            controlURL.setAction(portletWindow);
  +            nav.setAction(portletWindow);
           }
   
           if (parameters != null)
  @@ -125,19 +130,18 @@
                   : (String[]) value;
                   if (action)
                   {
  -                    controlURL.setRequestParam(
  +                    nav.setRequestParam(
                           NamespaceMapperAccess.getNamespaceMapper().encode(portletWindow.getId(), name),
                           values);
   
                   }
                   else
                   {
  -                    controlURL.setRenderParam(portletWindow, name, values);
  +                    nav.setRenderParam(portletWindow, name, values);
                   }
               }
           }
  -
  -        return portalUrl.toString(controlURL, new Boolean(secure));
  +        return nav.toString(secure);
       }
   
   }
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/url/impl/PortalControlParameter.java
  
  Index: PortalControlParameter.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.container.url.impl;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  import java.util.StringTokenizer;
  
  import javax.portlet.PortletMode;
  import javax.portlet.WindowState;
  
  import org.apache.jetspeed.Jetspeed;
  import org.apache.jetspeed.container.session.impl.*;
  import org.apache.jetspeed.container.url.*;
  import org.apache.jetspeed.container.url.impl.*;
  import org.apache.jetspeed.container.window.PortletWindowAccessor;
  import org.apache.pluto.om.window.PortletWindow;
  import org.apache.pluto.util.StringUtils;
  
  /**
   * Encode portlet control parameters into URLs using Pluto's portal method.  
   * It also can decode the same parameters.
   * 
   * NOTE: parts of this code were borrowed from Pluto's portal implementation.
   *
   * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
   * @version $Id: PortalControlParameter.java,v 1.1 2004/03/31 01:19:24 taylor Exp $
   */
  public class PortalControlParameter
  {
      static public final String ACTION = "ac";
  
      static public final String MODE = "md";
      static public final String PREFIX = "_";
      static public final String PREV_MODE = "pm";
      static public final String PREV_STATE = "ps";
      static public final String RENDER_PARAM = "rp";
      static public final String STATE = "st";
      static public final String KEY_DELIMITER = ":";
      static public final String PORTLET_ID = "pid";
  
      public static String decodeParameterName(String paramName)
      {
          return paramName.substring(PREFIX.length());
      }
  
      public static String decodeParameterValue(String paramName, String paramValue)
      {
          return paramValue;
      }
  
      private static String decodeRenderParamName(String encodedParamName)
      {
          StringTokenizer tokenizer = new StringTokenizer(encodedParamName, "_");
          if (!tokenizer.hasMoreTokens())
              return null;
          String constant = tokenizer.nextToken();
          if (!tokenizer.hasMoreTokens())
              return null;
          String objectId = tokenizer.nextToken();
          if (!tokenizer.hasMoreTokens())
              return null;
          String name = tokenizer.nextToken();
          return name;
      }
  
      private static String[] decodeRenderParamValues(String encodedParamValues)
      {
          StringTokenizer tokenizer = new StringTokenizer(encodedParamValues, "_");
          if (!tokenizer.hasMoreTokens())
              return null;
          String _count = tokenizer.nextToken();
          int count = Integer.valueOf(_count).intValue();
          String[] values = new String[count];
          for (int i = 0; i < count; i++)
          {
              if (!tokenizer.hasMoreTokens())
                  return null;
              values[i] = decodeValue(tokenizer.nextToken());
          }
          return values;
      }
  
      private static String decodeValue(String value)
      {
          value = StringUtils.replace(value, "0x1", "_");
          value = StringUtils.replace(value, "0x2", ".");
          return value;
      }
  
      public static String encodeParameter(String param)
      {
          return PREFIX + param;
      }
  
      public static String encodeRenderParamName(PortletWindow window, String paramName)
      {
          StringBuffer returnvalue = new StringBuffer(50);
          returnvalue.append(RENDER_PARAM);
          returnvalue.append("_");
          returnvalue.append(window.getId().toString());
          returnvalue.append("_");
          returnvalue.append(paramName);
          return returnvalue.toString();
      }
  
      public static String encodeRenderParamValues(String[] paramValues)
      {
          StringBuffer returnvalue = new StringBuffer(100);
          returnvalue.append(paramValues.length);
          for (int i = 0; i < paramValues.length; i++)
          {
              returnvalue.append("_");
              returnvalue.append(encodeValue(paramValues[i]));
          }
          return returnvalue.toString();
      }
  
      private static String encodeValue(String value)
      {
          value = StringUtils.replace(value, "_", "0x1");
          value = StringUtils.replace(value, ".", "0x2");
          return value;
      }
  
      public static String getRenderParamKey(PortletWindow window)
      {
          return RENDER_PARAM + "_" + window.getId().toString();
      }
  
      public static boolean isControlParameter(String param)
      {
          return param.startsWith(PREFIX);
      }
  
      public static boolean isStateFullParameter(String param)
      {
          if (isControlParameter(param))
          {
              if ((param.startsWith(PREFIX + MODE))
                  || (param.startsWith(PREFIX + PREV_MODE))
                  || (param.startsWith(PREFIX + STATE))
                  || (param.startsWith(PREFIX + PREV_STATE))
                  || (param.startsWith(PREFIX + RENDER_PARAM)))
              {
                  return true;
              }
          }
          return false;
      }
      private Map requestParameter = new HashMap();
      private Map stateFullControlParameter = null;
      private Map stateLessControlParameter = null;
  
      private PortalURL url;
  
      public PortalControlParameter(PortalURL url)
      {
          this.url = url;
          stateFullControlParameter = ((PortalURLImpl)this.url).getClonedStateFullControlParameter();
          stateLessControlParameter = ((PortalURLImpl) this.url).getClonedStateLessControlParameter();
      }
  
      public void clearRenderParameters(PortletWindow portletWindow)
      {
          String prefix = getRenderParamKey(portletWindow);
          Iterator keyIterator = stateFullControlParameter.keySet().iterator();
  
          while (keyIterator.hasNext())
          {
              String name = (String) keyIterator.next();
              if (name.startsWith(prefix))
              {
                  keyIterator.remove();
              }
          }
      }
  
      private String getActionKey(PortletWindow window)
      {
          return ACTION + "_" + window.getId().toString();
      }
  
      public PortletMode getMode(PortletWindow window)
      {
          String mode = (String) stateFullControlParameter.get(getModeKey(window));
          if (mode != null)
              return new PortletMode(mode);
          else
              return PortletMode.VIEW;
      }
  
      private String getModeKey(PortletWindow window)
      {
          return MODE + "_" + window.getId().toString();
      }
  
      public PortletWindow getPortletWindowOfAction() 
      {
          Iterator iterator = getStateLessControlParameter().keySet().iterator();
          PortletWindow portletWindow = null;
          while (iterator.hasNext())
          {
              String name = (String) iterator.next();
              if (name.startsWith(ACTION))
              {
                  String id = name.substring(ACTION.length() + 1);
                  /*
                  
                  TODO: BROKEN: need to go the profiler to get the profile, psml, and then window for an entity
                  this is normally done in the aggregator valve, need to sort out the sequence 
                  
                  Fragment fragment = org.apache.pluto.portalImpl.services.pageregistry.PageRegistry.getFragment(id);
                  if(fragment instanceof PortletFragment) {
                      return ((PortletFragment)fragment).getPortletWindow();
                  }
  
                  StringTokenizer idTokenizer = new StringTokenizer(id, KEY_DELIMITER);
                  String portletName = idTokenizer.nextToken();
                  String sequence = idTokenizer.nextToken();
                  String entityName = idTokenizer.nextToken();
                  PortletRegistryComponent registry =
                      (PortletRegistryComponent) Jetspeed.getComponentManager().getComponent(PortletRegistryComponent.class);
                  PortletDefinition portletDefinition = registry.getPortletDefinitionByUniqueName(entityName + "::" + portletName);
                  
                  if (portletDefinition == null)
                  {
                      throw new JetspeedException("Failed to load: " + portletName + " from registry");
                  }
                      */
  
                  // TODO: deprecate this class and reimplment as a NavigationalState component
  
                  PortletWindowAccessor windowAccessor = 
                      (PortletWindowAccessor) Jetspeed.getComponentManager().getComponent(PortletWindowAccessor.class);
                  portletWindow = windowAccessor.getPortletWindow(id);
                  /*
                  PortletEntityAccessComponent entityAccess = 
                      (PortletEntityAccessComponent) Jetspeed.getComponentManager().getComponent(PortletEntityAccessComponent.class);
                  ObjectID entityId = JetspeedObjectID.createFromString(id);
                  
                  PortletEntity entity = entityAccess.getPortletEntity(entityId);
                  portletWindow = entityAccess.getPortletWindow(entity);
                  
                  portletWindow = PortletWindowFactory.getWindow(portletDefinition, entityName);
                      */
              }
          }
  
          return portletWindow;
      }
  
      public PortletMode getPrevMode(PortletWindow window)
      {
          String mode = (String) stateFullControlParameter.get(getPrevModeKey(window));
          if (mode != null)
              return new PortletMode(mode);
          else
              return null;
      }
      private String getPrevModeKey(PortletWindow window)
      {
          return PREV_MODE + "_" + window.getId().toString();
      }
  
      public WindowState getPrevState(PortletWindow window)
      {
          String state = (String) stateFullControlParameter.get(getPrevStateKey(window));
          if (state != null)
              return new WindowState(state);
          else
              return null;
      }
      private String getPrevStateKey(PortletWindow window)
      {
          return PREV_STATE + "_" + window.getId().toString();
      }
  
      public Iterator getRenderParamNames(PortletWindow window)
      {
          ArrayList returnvalue = new ArrayList();
          String prefix = getRenderParamKey(window);
          Iterator keyIterator = stateFullControlParameter.keySet().iterator();
  
          while (keyIterator.hasNext())
          {
              String name = (String) keyIterator.next();
              if (name.startsWith(prefix))
              {
                  returnvalue.add(name.substring(prefix.length() + 1));
              }
          }
  
          return returnvalue.iterator();
      }
  
      public String[] getRenderParamValues(PortletWindow window, String paramName)
      {
          String encodedValues = (String) stateFullControlParameter.get(encodeRenderParamName(window, paramName));
          String[] values = decodeRenderParamValues(encodedValues);
          return values;
      }
  
      public Map getRequestParameter()
      {
          return requestParameter;
      }
  
      public WindowState getState(PortletWindow window)
      {
          String state = (String) stateFullControlParameter.get(getStateKey(window));
          if (state != null)
              return new WindowState(state);
          else
              return WindowState.NORMAL;
      }
  
      public Map getStateFullControlParameter()
      {
          return stateFullControlParameter;
      }
  
      private String getStateKey(PortletWindow window)
      {
          return STATE + "_" + window.getId().toString();
      }
  
      public Map getStateLessControlParameter()
      {
          return stateLessControlParameter;
      }
  
      public boolean isOnePortletWindowMaximized()
      {
          Iterator iterator = stateFullControlParameter.keySet().iterator();
          while (iterator.hasNext())
          {
              String name = (String) iterator.next();
              if (name.startsWith(STATE))
              {
                  if (stateFullControlParameter.get(name).equals(WindowState.MAXIMIZED.toString()))
                  {
                      return true;
                  }
              }
          }
          return false;
      }
  
      public void setAction(PortletWindow window)
      {
          getStateFullControlParameter().put(getActionKey(window), ACTION.toUpperCase());
      }
  
      public void setMode(PortletWindow window, PortletMode mode)
      {
          Object prevMode = stateFullControlParameter.get(getModeKey(window));
          if (prevMode != null)
              stateFullControlParameter.put(getPrevModeKey(window), prevMode);
          // set current mode
          stateFullControlParameter.put(getModeKey(window), mode.toString());
      }
  
      public void setRenderParam(PortletWindow window, String name, String[] values)
      {
          String encodedKey = encodeRenderParamName(window, name);
          String encodedValue = encodeRenderParamValues(values);
          stateFullControlParameter.put(encodedKey, encodedValue);
          // setRequestParam(encodedKey, values);
      }
  
      /*
          public void setRequestParam(String name, String value)
          {
              requestParameter.put(name, value );
          }
      */
      public void setRequestParam(String name, String[] values)
      {
          requestParameter.put(name, values);
      }
  
      public void setState(PortletWindow window, WindowState state)
      {
          Object prevState = stateFullControlParameter.get(getStateKey(window));
          if (prevState != null)
              stateFullControlParameter.put(getPrevStateKey(window), prevState);
          stateFullControlParameter.put(getStateKey(window), state.toString());
      }
  
      public String getPIDValue()
      {
          String value = (String) stateLessControlParameter.get(getPortletIdKey());
          return value == null ? "" : value;
      }
  
      private String getPortletIdKey()
      {
          return PORTLET_ID;
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/url/impl/PortalURLImpl.java
  
  Index: PortalURLImpl.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.container.url.impl;
  
  import java.util.Iterator;
  import java.util.List;
  import java.util.HashMap;
  import java.util.Map;
  import java.util.ArrayList;
  import java.util.StringTokenizer;
  
  import javax.servlet.http.HttpServletRequest;
  
  import org.apache.pluto.om.window.PortletWindow;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.jetspeed.Jetspeed;
  import org.apache.jetspeed.container.session.impl.*;
  import org.apache.jetspeed.container.url.*;
  import org.apache.jetspeed.request.RequestContext;
  import org.apache.jetspeed.request.RequestContextComponent;
  
  /**
   * As part of its content, a portlet may need to create URLs that reference the portlet itself.
   * For example, when a user acts on a URL that references a portlet (i.e., by clicking a link
   * or submitting a form) the result is a new client request to the portal targeted to the portlet.
   * Those URLs are called portlet URLs.
   * 
   * NOTE: parts of this code was borrowed from Pluto's portal implementation.
   *
   * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
   * 
   * @version $Id: PortalURLImpl.java,v 1.1 2004/03/31 01:19:24 taylor Exp $
   */
  public class PortalURLImpl implements PortalURL
  {
      private static final Log log = LogFactory.getLog(PortalURLImpl.class);
  
      private RequestContext context;
      private List startGlobalNavigation = new ArrayList();
      private List startLocalNavigation = new ArrayList();
      private HashMap startControlParameter = new HashMap();
      private HashMap startStateLessControlParameter = new HashMap();
      private boolean analyzed = false;
      private boolean secure;
  
      private String serverName;
      private String serverScheme;
      private String contextPath;
      private String basePath;
      private int serverPort;
  
      /**
       * Creates and URL pointing to the home of the portal
       * 
       * @param env     the portal environment
       */
      public PortalURLImpl(RequestContext context)
      {
          this.context = context;
          init(context);
      }
  
      public void init(RequestContext context)
      {
          if (null != context.getRequest())
          {
              this.serverName = context.getRequest().getServerName();
              this.serverPort = context.getRequest().getServerPort();
              this.serverScheme = context.getRequest().getScheme();
              this.contextPath = context.getRequest().getContextPath();
              this.basePath = contextPath + context.getRequest().getServletPath();
          }
      }
  
      /**
       * Creates and URL pointing to the home of the portal
       * 
       * @param request     the servlet request
       */
      public PortalURLImpl(HttpServletRequest request)
      {
          // TODO: assemble this
          RequestContextComponent rcc = (RequestContextComponent)Jetspeed.getComponentManager().getComponent(RequestContextComponent.class);
          this.context = rcc.getRequestContext(request);
          init(context);
      }
  
      /**
       * Adds a navigational information pointing to a portal part, e.g. PageGroups
       * or Pages
       * 
       * @param nav    the string pointing to a portal part
       */
      public void addGlobalNavigation(String nav)
      {
          startGlobalNavigation.add(nav);
      }
  
      /**
       * Sets the local navigation. Because the local navigation is always handled
       * by the Browser, therefore the local navigation cleared.
       */
      public void setLocalNavigation()
      {
          startLocalNavigation = new ArrayList();
      }
  
      /**
       * Adds a navigational information pointing to a local portal part inside
       * of a global portal part, e.g. a portlet on a page
       * 
       * @param nav    the string pointing to a local portal part
       */
      public void addLocalNavigation(String nav)
      {
          startLocalNavigation.add(nav);
      }
  
      /**
       * Returns true if the given string is part of the global navigation of this URL
       * 
       * @param nav    the string to check
       * @return true, if the string is part of the navigation
       */
      public boolean isPartOfGlobalNavigation(String nav)
      {
          return startGlobalNavigation.contains(nav);
      }
  
      /**
       * Returns true if the given string is part of the local navigation of this URL
       * 
       * @param nav    the string to check
       * @return true, if the string is part of the navigation
       */
      public boolean isPartOfLocalNavigation(String nav)
      {
          return startLocalNavigation.contains(nav);
      }
  
      public String getGlobalNavigationAsString()
      {
          StringBuffer result = new StringBuffer(200);
          Iterator iterator = startGlobalNavigation.iterator();
          if (iterator.hasNext())
          {
              result.append((String) iterator.next());
              while (iterator.hasNext())
              {
                  result.append("/");
                  result.append((String) iterator.next());
              }
          }
          return result.toString();
      }
  
      public String getLocalNavigationAsString()
      {
          StringBuffer result = new StringBuffer(30);
          Iterator iterator = startLocalNavigation.iterator();
          if (iterator.hasNext())
          {
              result.append((String) iterator.next());
              while (iterator.hasNext())
              {
                  result.append(".");
                  result.append((String) iterator.next());
              }
          }
          return result.toString();
      }
  
      public String getControlParameterAsString(PortalControlParameter controlParam)
      {
          Map stateFullParams = startControlParameter;
          Map stateLessParams = null;
          if (controlParam != null)
          {
              stateFullParams = controlParam.getStateFullControlParameter();
              stateLessParams = controlParam.getStateLessControlParameter();
          }
  
          StringBuffer result = new StringBuffer(100);
          Iterator iterator = stateFullParams.keySet().iterator();
          while (iterator.hasNext())
          {
              if (iterator.hasNext())
                  result.append("/");
              String name = (String) iterator.next();
              result.append(PortalControlParameter.encodeParameter(name));
              result.append("/");
              result.append((String) stateFullParams.get(name));
          }
  
          return result.toString();
      }
  
      public String getRequestParameterAsString(PortalControlParameter controlParam)
      {
          if (controlParam != null)
          {
              Map requestParams = controlParam.getRequestParameter();
  
              StringBuffer result = new StringBuffer(100);
              Iterator iterator = requestParams.keySet().iterator();
              boolean hasNext = iterator.hasNext();
              if (hasNext)
              {
                  result.append("?");
              }
  
              while (hasNext)
              {
  
                  String name = (String) iterator.next();
                  Object value = requestParams.get(name);
                  String[] values = value instanceof String ? new String[] {(String) value }
                  : (String[]) value;
  
                  int i;
  
                  result.append(name);
                  result.append("=");
                  result.append(values[0]);
                  for (i = 1; i < values.length; i++)
                  {
                      result.append("&");
                      result.append(name);
                      result.append("=");
                      result.append(values[i]);
                  };
  
                  hasNext = iterator.hasNext();
                  if (hasNext)
                      result.append("&");
              }
  
              return result.toString();
          }
          return "";
      }
  
      public String toString()
      {
          return toString(null, null);
      }
  
      public String toString(PortalControlParameter controlParam, Boolean p_secure)
      {
          StringBuffer buffer = getBaseURLBuffer();
          buffer.append(this.basePath);
  
          String global = getGlobalNavigationAsString();
          if (global.length() > 0)
          {
              buffer.append("/");
              buffer.append(global);
          }
  
          String control = getControlParameterAsString(controlParam);
          if (control.length() > 0)
          {
              buffer.append(control);
          }
  
          String requestParam = getRequestParameterAsString(controlParam);
          if (requestParam.length() > 0)
          {
              buffer.append(requestParam);
          }
  
          String local = getLocalNavigationAsString();
          if (local.length() > 0)
          {
              buffer.append("#");
              buffer.append(local);
          }
  
          String finalUrl = buffer.toString();
          log.debug("PortalUrl before encode: " + finalUrl);
          return context.getResponse().encodeURL(finalUrl);
      }
  
      Map getClonedStateFullControlParameter()
      {
          analyzeRequestInformation();
          return (Map) startControlParameter.clone();
      }
  
      Map getClonedStateLessControlParameter()
      {
          analyzeRequestInformation();
          return (Map) startStateLessControlParameter.clone();
      }
  
      public void analyzeControlInformation(PortalControlParameter control)
      {
          startControlParameter = (HashMap) control.getStateFullControlParameter();
          startStateLessControlParameter = (HashMap) control.getStateLessControlParameter();
      }
  
      void analyzeRequestInformation()
      {
          if (analyzed)
              return;
  
          startGlobalNavigation = new ArrayList();
          startLocalNavigation = new ArrayList();
          startControlParameter = new HashMap();
          startStateLessControlParameter = new HashMap();
  
          // check the complete pathInfo for
          // * navigational information
          // * control information
          String pathInfo = context.getRequest().getPathInfo();
  
          if (pathInfo != null)
          {
              StringTokenizer tokenizer = new StringTokenizer(pathInfo, "/.");
  
              int mode = 0; // 0=navigation, 1=control information
              String name = null;
              while (tokenizer.hasMoreTokens())
              {
                  String token = tokenizer.nextToken();
                  if (PortalControlParameter.isControlParameter(token))
                  {
                      mode = 1;
                      name = token;
                  }
                  else if (mode == 0)
                  {
                      startGlobalNavigation.add(token);
                  }
                  else if (mode == 1)
                  {
                      if ((PortalControlParameter.isStateFullParameter(name)))
                      {
                          startControlParameter.put(
                              PortalControlParameter.decodeParameterName(name),
                              PortalControlParameter.decodeParameterValue(name, token));
                      }
                      else
                      {
                          startStateLessControlParameter.put(
                              PortalControlParameter.decodeParameterName(name),
                              PortalControlParameter.decodeParameterValue(name, token));
                      }
                      mode = 0;
                  }
              }
          }
          analyzed = true;
  
      }
  
      public void setRenderParameter(PortletWindow portletWindow, String name, String[] values)
      {
          startControlParameter.put(
              PortalControlParameter.encodeRenderParamName(portletWindow, name),
              PortalControlParameter.encodeRenderParamValues(values));
  
      }
  
      public void clearRenderParameters(PortletWindow portletWindow)
      {
          String prefix = PortalControlParameter.getRenderParamKey(portletWindow);
          Iterator keyIterator = startControlParameter.keySet().iterator();
  
          while (keyIterator.hasNext())
          {
              String name = (String) keyIterator.next();
              if (name.startsWith(prefix))
              {
                  keyIterator.remove();
              }
          }
      }
  
      public String getBaseURL()
      {
          return getBaseURLBuffer().toString();
      }
  
      public String getContext()
      {
          StringBuffer result = getBaseURLBuffer();
          result.append(this.contextPath);
          return result.toString();
      }
  
      private StringBuffer getBaseURLBuffer()
      {
          StringBuffer buffer = new StringBuffer();
          buffer.append(this.serverScheme);
          buffer.append("://");
          buffer.append(this.serverName);
          if ((this.serverScheme.equals(HTTP) && this.serverPort != 80)
              || (this.serverScheme.equals(HTTPS) && this.serverPort != 443))
          {
              buffer.append(":");
              buffer.append(this.serverPort);
          }
          return buffer;
      }
  
  }
  
  
  
  1.5       +56 -4     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/PathNavigationalState.java
  
  Index: PathNavigationalState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/PathNavigationalState.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PathNavigationalState.java	30 Mar 2004 22:00:20 -0000	1.4
  +++ PathNavigationalState.java	31 Mar 2004 01:19:24 -0000	1.5
  @@ -15,15 +15,19 @@
    */
   package org.apache.jetspeed.container.session.impl;
   
  +import java.util.Iterator;
  +
   import javax.portlet.PortletMode;
   import javax.portlet.WindowState;
   
   import org.apache.jetspeed.container.session.NavigationalState;
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
  -import org.apache.jetspeed.engine.core.PortalURL;
  +import org.apache.jetspeed.container.url.PortalURL;
  +import org.apache.jetspeed.container.url.impl.PortalControlParameter;
  +import org.apache.jetspeed.container.url.impl.PortalURLImpl;
   import org.apache.jetspeed.request.RequestContext;
   import org.apache.pluto.om.window.PortletWindow;
   
  +
   /**
    * PathNavigationalStateContext is based on Pluto navigational state.
    * All nav state is stored as path parameters in the URL.
  @@ -46,7 +50,7 @@
       public void init(RequestContext context)
       {
           this.context = context;
  -        this.url = context.getRequestedPortalURL();
  +        this.url = new PortalURLImpl(context);
           this.pcp = new PortalControlParameter(url);        
       }
       
  @@ -85,5 +89,53 @@
           return PortalControlParameter.isControlParameter(token);
       }
       
  +    public Iterator getRenderParamNames(PortletWindow window)
  +    {
  +        return pcp.getRenderParamNames(window);
  +    }
       
  +    public String[] getRenderParamValues(PortletWindow window, String paramName)
  +    {
  +        return pcp.getRenderParamValues(window, paramName);
  +    }
  +
  +    public PortletWindow getPortletWindowOfAction()
  +    {
  +        return pcp.getPortletWindowOfAction();
  +    }
  +    
  +    public void clearRenderParameters(PortletWindow portletWindow)
  +    {
  +        pcp.clearRenderParameters(portletWindow);
  +    }
  +    
  +    public void setAction(PortletWindow window)
  +    {
  +        pcp.setAction(window);
  +    }
  +    
  +    public void setRequestParam(String name, String[] values)
  +    {
  +        pcp.setRequestParam(name, values);
  +    }
  +    
  +    public void setRenderParam(PortletWindow window, String name, String[] values)
  +    {
  +        pcp.setRenderParam(window, name, values);
  +    }
  +    
  +    public String toString()
  +    {
  +        return toString(false);
  +    }
  +
  +    public String toString(boolean secure)
  +    {        
  +        return url.toString(pcp, new Boolean(secure));
  +    }
  +    
  +    public String getBaseURL()
  +    {
  +        return url.getBaseURL();
  +    }
   }
  
  
  
  1.5       +4 -42     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/SessionNavigationalState.java
  
  Index: SessionNavigationalState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/SessionNavigationalState.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SessionNavigationalState.java	30 Mar 2004 22:00:20 -0000	1.4
  +++ SessionNavigationalState.java	31 Mar 2004 01:19:24 -0000	1.5
  @@ -15,12 +15,8 @@
    */
   package org.apache.jetspeed.container.session.impl;
   
  -import javax.portlet.PortletMode;
  -import javax.portlet.WindowState;
  -
   import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.request.RequestContext;
  -import org.apache.pluto.om.window.PortletWindow;
   
   /**
    * SessionNavigationalStateContext
  @@ -29,6 +25,8 @@
    * @version $Id$
    */
   public class SessionNavigationalState
  +        extends
  +            PathNavigationalState // for now until we implement it
           implements
               NavigationalState 
   {
  @@ -36,45 +34,9 @@
       
       public SessionNavigationalState(RequestContext context)
       {
  -        init(context);        
  -    }
  -    
  -    public void init(RequestContext context)
  -    {
  -        this.context = context;
  -    }
  -    
  -    public WindowState getState(PortletWindow window) 
  -    {
  -        return null;
  -    }
  -    
  -    public void setState(PortletWindow window, WindowState state) 
  -    {
  +        super(context);
       }
       
  -    public PortletMode getMode(PortletWindow window) 
  -    {
  -        return null;
  -    }
       
  -    public void setMode(PortletWindow window, PortletMode mode) 
  -    {
  -    }
  -    
  -    public PortletMode getPreviousMode(PortletWindow window) 
  -    {
  -        return null;
  -    }
  -    
  -    public WindowState getPreviousState(PortletWindow window) 
  -    {
  -        return null;
  -    }
  -    
  -    public boolean isNavigationalParameter(String token)
  -    {
  -        return false;
  -    }
       
   }
  
  
  
  1.4       +4 -4      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/BasicAggregator.java
  
  Index: BasicAggregator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/BasicAggregator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BasicAggregator.java	17 Mar 2004 22:19:53 -0000	1.3
  +++ BasicAggregator.java	31 Mar 2004 01:19:24 -0000	1.4
  @@ -25,8 +25,8 @@
   import org.apache.commons.logging.LogFactory;
   import org.apache.jetspeed.aggregator.Aggregator;
   import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
  +import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.container.window.PortletWindowAccessor;
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.om.page.Page;
  @@ -140,8 +140,8 @@
               HttpServletRequest servletRequest = request.getRequestForWindow(portletWindow);
               HttpServletResponse servletResponse = request.getResponseForWindow(portletWindow);
   
  -            PortalControlParameter control = new PortalControlParameter(request.getRequestedPortalURL());
  -            WindowState windowState = control.getState(portletWindow);
  +            NavigationalState state = request.getNavigationalState();            
  +            WindowState windowState = state.getState(portletWindow);
   
               container.renderPortlet(portletWindow, servletRequest, servletResponse);
           }
  
  
  
  1.4       +5 -6      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/ContainerValve.java
  
  Index: ContainerValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/ContainerValve.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContainerValve.java	8 Mar 2004 00:24:59 -0000	1.3
  +++ ContainerValve.java	31 Mar 2004 01:19:24 -0000	1.4
  @@ -19,8 +19,7 @@
   import org.apache.commons.logging.LogFactory;
   
   import org.apache.jetspeed.request.RequestContext;
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
  -import org.apache.jetspeed.engine.core.PortalURL;
  +import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.pipeline.PipelineException;
   import org.apache.jetspeed.pipeline.valve.AbstractValve;
   import org.apache.jetspeed.pipeline.valve.ValveContext;
  @@ -45,10 +44,10 @@
       {
           try
           {  
  -            PortalURL currentURL = request.getRequestedPortalURL();
               //PortletContainerServices.prepare();
  -            PortalControlParameter control = new PortalControlParameter(currentURL);
  -            PortletWindow actionWindow = control.getPortletWindowOfAction();
  +            
  +            NavigationalState nav = request.getNavigationalState();
  +            PortletWindow actionWindow = nav.getPortletWindowOfAction();
               if (null == actionWindow)
               {
                   // set to null to denote that no action was requested
  
  
  
  1.5       +27 -2     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/NavigationalState.java
  
  Index: NavigationalState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/NavigationalState.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NavigationalState.java	30 Mar 2004 22:00:19 -0000	1.4
  +++ NavigationalState.java	31 Mar 2004 01:19:24 -0000	1.5
  @@ -15,13 +15,15 @@
    */
   package org.apache.jetspeed.container.session;
   
  +import java.util.Iterator;
  +
   import javax.portlet.PortletMode;
   import javax.portlet.WindowState;
   
   import org.apache.pluto.om.window.PortletWindow;
   
   /**
  - * NavigationalStateContext
  + * NavigationalState contains the state of the Portal URL and all navigational state context
    *
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
  @@ -40,5 +42,28 @@
       
       WindowState getPreviousState(PortletWindow window);
       
  +    ///////////////////////////////////////////////
  +    
       boolean isNavigationalParameter(String token);
  +    
  +    Iterator getRenderParamNames(PortletWindow window);
  +    
  +    String[] getRenderParamValues(PortletWindow window, String paramName);
  +
  +    PortletWindow getPortletWindowOfAction();
  +    
  +    void clearRenderParameters(PortletWindow portletWindow);
  +    
  +    void setAction(PortletWindow window);
  +    
  +    void setRequestParam(String name, String[] values);
  +    
  +    void setRenderParam(PortletWindow window, String name, String[] values);
  +    
  +    String toString();
  +    
  +    String toString(boolean secure);
  +    
  +    String getBaseURL();
  +    
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message