0 Replies Latest reply on Nov 4, 2008 11:35 AM by kapitanpetko

    cid no appended to URL when using page actions?

    kapitanpetko

      I have the following in pages.xml:


      <page view-id="/user-list.xhtml" login-required="true">
        <action execute="#{userManager.filter}" />
        <navigation>
          <rule if-outcome="edit">
             ...
        </navigation>
      </page>
      
      <page view-id="*">
       <navigation>
           <rule if-outcome="list-users">
              <end-conversation before-redirect="true" />
              <redirect view-id="/user-list.xhtml"/>
            </rule>
        </navigation>
      </page>
      



      Combined with an <s:link action='list-users' value='List Users'/> what this does when I click the link is:



      1. end the current conversation

      2. start a new LRC, get a list of users based on current filter criteria (#{userManager.filter})

      3. redirect to the user list page and display the list of users



      While this mostly works, I have the following problem: the URL I am redirected to does not have the cid parameter.
      On the next redirect (say viewing user details), the cid is appended to the URL as expected. The problem with this is,
      that it breaks back button navigation:



      1. click 'List Users: redirect to /user-list.seam (current conversation ID is 123, but no cid in URL)

      2. click 'User Details': redirect to /usr-details.seam?cid=123

      3. back button: go back to /user-list.seam (no cid -> no conversation state -> list filtering is reset)



      What I'd like to do is have the cid of the conversation started in the page action for my list page.
      However, in combination with <end-conversation before-redirect="true" /> that doesn't work.
      I've traced it to Manager#encodeConversationIdParameter:


       private String encodeConversationIdParameter(String url, String paramName, String paramValue)
         {         
            if ( Session.instance().isInvalid() || containsParameter(url, paramName) )
            {
               return url;
            }
            else if (destroyBeforeRedirect)
            {
               if ( isNestedConversation() )
               {
                  ...
               }
               else
               {
                  return url; // cid is not appended
               }
            }
            else 
            {
                // cid is appended
                 StringBuilder builder = new StringBuilder( url.length() + paramName.length() + 5 )
                     .append(url)
                     .append( url.contains("?") ? '&' : '?' )
                     .append(paramName)
                     .append('=')
                     .append( encode(paramValue) );
               ....
            }
      }
      



      Is there a way to append the cid in the above setup? Or is this a problem with Manager#encodeConversationIdParameter?


      BTW, I've tried using #{conversation.id} in pages.xml but that does not work properly (returns the old conversation's ID).