ate         2005/04/21 02:00:40

  Modified:    portal/src/java/org/apache/jetspeed/container/state/impl
                        JetspeedNavigationalStateCodec.java
  Log:
  Fixing http://issues.apache.org/jira/browse/JS2-194 and 
http://issues.apache.org/jira/browse/JS2-231.
  Render parameters are now properly cleared conforming to the Portlet API 
requirements.
  
  Also fixed: when using SessionFullNavigationalState (the default), encoded 
stated of the targeted PortletWindow ended up being postfixed
  in the encoded state of the last non-targeted PortletWindow.
  
  Revision  Changes    Path
  1.4       +34 -8     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/state/impl/JetspeedNavigationalStateCodec.java
  
  Index: JetspeedNavigationalStateCodec.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/state/impl/JetspeedNavigationalStateCodec.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JetspeedNavigationalStateCodec.java       19 Oct 2004 20:20:36 -0000      
1.3
  +++ JetspeedNavigationalStateCodec.java       21 Apr 2005 09:00:40 -0000      
1.4
  @@ -212,7 +212,7 @@
           targetState.setWindowState(windowState != null ? windowState : 
currentState != null ? currentState.getWindowState() : null);
   
           // never retain actionRequest parameters nor session stored 
renderParameters
  -        if ( currentState != null && states.getActionWindow() != window && 
!renderParamsStateFull)
  +        if ( currentState != null && !renderParamsStateFull )
           {
               // retain current request parameters if any
               if ( currentState.getParametersMap() != null )
  @@ -265,6 +265,8 @@
       throws UnsupportedEncodingException
       {
           StringBuffer buffer = new StringBuffer();
  +        String encodedState;
  +        boolean haveState = false;
           
           // skip other states if all non-targeted PortletWindow states are 
kept in the session
           if ( !navParamsStateFull || !renderParamsStateFull )
  @@ -282,16 +284,39 @@
                   }
                   else
                   {
  -                    
buffer.append(encodePortletWindowNavigationalState(windowId, pwfns, false, 
navParamsStateFull, 
  -                            renderParamsStateFull));
  +                    encodedState = 
encodePortletWindowNavigationalState(windowId, pwfns, false, 
navParamsStateFull, 
  +                            renderParamsStateFull);
  +                    if ( encodedState.length() > 0 )
  +                    {
  +                        if ( !haveState )
  +                        {
  +                            haveState = true;
  +                        }
  +                        else
  +                        {
  +                            buffer.append(PARAMETER_SEPARATOR);
  +                        }
  +                        buffer.append(encodedState);
  +                    }
                   }
               }
           }
  -        buffer.append(encodePortletWindowNavigationalState(targetWindowId, 
targetState, action, 
  -                false, false));
  +        encodedState = encodePortletWindowNavigationalState(targetWindowId, 
targetState, action, false, false); 
  +        if ( encodedState.length() > 0 )
  +        {
  +            if ( !haveState )
  +            {
  +                haveState = true;
  +            }
  +            else
  +            {
  +                buffer.append(PARAMETER_SEPARATOR);
  +            }
  +            buffer.append(encodedState);
  +        }
           
           String encodedNavState = null;
  -        if ( buffer.length() > 0 )
  +        if ( haveState )
           {
               encodedNavState = encodeParameters(buffer.toString(), 
states.getCharacterEncoding());
           }
  @@ -356,7 +381,7 @@
                   
buffer.append(encodeArgument(paramBuffer.toString(),PARAMETER_SEPARATOR));
               }
           }
  -        else if ( renderParamsStateFull && state.isClearParameters() )
  +        else if ( state.isClearParameters() )
           {
               // Special case: for a targeted PortletWindow for which no 
parameters are specified 
               // indicate its saved (in the session) request parameters must 
be cleared instead of copying them when
  @@ -364,6 +389,7 @@
               // During decoding this CLEAR_PARAMS_KEY will set the 
clearParameters flag of the PortletWindowRequestNavigationalState.
               buffer.append(PARAMETER_SEPARATOR);
               buffer.append(CLEAR_PARAMS_KEY);            
  +            encoded = true;
           }
           return encoded ? buffer.toString() : "";
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to