0 Replies Latest reply on Jul 28, 2009 9:24 AM by Vasilii Lukoyanov

    returnToCapturedView returns to different conversation

    Vasilii Lukoyanov Newbie


      I'm trying to implement return-to-previous-page-after-login feature. The problem I stuck with is when I'm returned to previous page previous conversation isn't restored.

      More specifically:
      On a /home.seam I have a search box.


          <f:facet name="header">Quick find product:</f:facet>
             <h:form id="searchForm" >             
                 <h:inputText size="50" value="#{productSearchAction.queryString}" />
              <h:commandButton value="Find" action="#{productSearchAction.search}">                            


      public class ProductSearchAction {
          @Begin(join = true)
          public String search() throws ParseException {
              org.apache.lucene.search.Query luceneQuery =
                  new MultiFieldQueryParser(new String[] {"name", "model", "description"},
                          new StandardAnalyzer()).parse(_queryString);
              javax.persistence.Query query = _entityManager.createFullTextQuery(luceneQuery,
              return "search";


      <raise-event type="com.meshop.event.captureView" />


           <event type="org.jboss.seam.security.notLoggedIn">
                <action execute="#{loginRedirector.captureCurrentView}" />
           <event type="com.meshop.event.captureView">
              <action execute="#{loginRedirector.captureCurrentView}" />
           <event type="org.jboss.seam.security.postAuthenticate">
                <action execute="#{loginRedirector.returnToCapturedView}" />


      public class LoginRedirector {
          private Redirect _redirect;
          private Identity _identity;
          private Redirect _savedRedirect;
          public void captureCurrentView() {
              if (_identity != null && !_identity.isLoggedIn()) {
                  _savedRedirect = _redirect;
          public void returnToCapturedView()  {
              if (_savedRedirect != null && _savedRedirect.getViewId() == null
                      || !_savedRedirect.getViewId().contains("error.xhtml")) {

      When I enter query and hit 'Find' i'm redirected to search.seam. Then I press sign in button and enter login info. After that i'm redirected back to search, but cid is different (therefore no previous search results). On debug.seam i can see that the valid conversation is present.