5 Replies Latest reply on Jul 31, 2008 3:15 PM by mirco

    Is there really NO WAY to make a CLEAN redirect with Seam?

    mirco

      I just lost another day figuring out simple things that work without seam....
      I am desperately trying to redirect from action to /somedirectory/ . That's it !


      However, I don't want


      "/somedirectory/.seam", nor "/somedirectory/?cid=XXX"




      Just a simple redirect. RESTful. No seam stuff. Is it impossible?


      Btw. stuff like context.getExternalContext().getResponse()).sendRedirect, or just returning a string, does not work. They ALWAYS add something to the URL, event with Redirect.setConversationPropagationEnabled( false )

        • 1. Re: Is there really NO WAY to make a CLEAN redirect with Seam?
          christian.bauer
                  ExternalContext ctx = FacesContext.getCurrentInstance().getExternalContext();
                  try {
                      ctx.redirect(ctx.encodeResourceURL(url));
                  } catch (IOException ioe) {
                      throw new RedirectException(ioe);
                  }
                  FacesContext.getCurrentInstance().responseComplete();
          



          This is plain JSF, nothing required in Seam.

          • 2. Re: Is there really NO WAY to make a CLEAN redirect with Seam?
            christian.bauer

            Of course you can also do this in Seam 2.1 in pages.xml:


              <navigation>
                  <rule if-outcome="myActionOutcome">
                       <redirect url="http://whatever"/>
            

            • 3. Re: Is there really NO WAY to make a CLEAN redirect with Seam?
              mirco

              Danke Christian :-) for your fast response. Unfortunatelly, your solution is not working.


              Your first solution redirects to


              /somedirectory/?cid=XXX



              Your second solution might work but is not useful for me, because my application generates URL from the database. pages.xml won't help.


              I am afraid, after many troubles with seam, the life is easier without it. On some places it helps, but it adds alot of troubles elsewhere. Unfortunatelly, most of the nice features ends when users open another tab in their session, or use back button. Even the demo application that used to work at http://seam.demo.jboss.com /not working for weeks now/ fails if you use back button on search output.


              Thank you so much for trying to help me with my pain :-)

              • 4. Re: Is there really NO WAY to make a CLEAN redirect with Seam?
                christian.bauer

                Miroslav Liska wrote on Jul 30, 2008 19:31:


                Your first solution redirects to

                /somedirectory/?cid=XXX




                I took this code from the application you are looking at. It does not append a conversation id there.



                Your second solution might work but is not useful for me, because my application generates URL from the database. pages.xml won't help.


                Why not? The value of the url attribute can be an EL expression.

                • 5. Re: Is there really NO WAY to make a CLEAN redirect with Seam?
                  mirco

                  I took this code from the application you are looking at. It does not append a conversation id there.

                  Are there any conversation-related settings on this application? Because..... I keep getting


                  /somedirectory/?cid=XXX



                  with your code inserted into my application. Or is there another way to bypass seam related filters when redirecting?