3 Replies Latest reply on Jul 15, 2010 10:40 PM by mconroy

    page.xml redirect with parameter

      I am attempting to redirect to a page on another web application. The following code works correct, but the parameters are not passed. I have verified that the parameters are set by modifying the url attribute to include the ?proj=#{project.number} at which point the receiving site gets the parameter. Can parameters be specified using a page.xml in this fashion?


      <navigation from-action="#{project.open}">
                <rule if-outcome="true">
                     <redirect url="http://someurl.com">
                          <param name="proj" value="#{project.number}" />
                          
                     </redirect>
                     <end-conversation/>
                </rule>
           </navigation>


      I am using 2.2.0GA.

      Thanks All!

        • 1. Re: page.xml redirect with parameter
          Can't be done. I'm guessing that the params are for forwarding purposes only...

          http://www.javapractices.com/topic/TopicAction.do?Id=181
          Redirect

              * a redirect is a two step process, where the web application instructs the browser to fetch a second URL, which differs from the original
              * a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL
              * redirect is marginally slower than a forward, since it requires two browser requests, not one
              * objects placed in the original request scope are not available to the second request
          • 2. Re: page.xml redirect with parameter
            serkan.s.eskici.online.nl

            Are you calling #{project.open} from your JSF page within a link or a button ?


            Then pass the parameter within those components.


            Example:


            <s:link action="#{project.open}" ...>
               <f:param name="proj" value="#{project.number}"/>
            </s:link>
            

            • 3. Re: page.xml redirect with parameter

              Note: I am a Seam newbie...



              Thanks for the response Serkan!




              Unfortunately I was trying to do something far more quirky than that. I was attempting to do a web redirect to another context and post the data. This is probably my failed attempt, but the project will be a authentication front end for several applications. The new application will collect authentication info and then forward some type of security token on. I thought about using a get request, but I would like to avoid having encrypted credentials in the url.


              I found an interesting way of doing this by creating a custom servlet to intercept the web request and insert the parameters in the request attributes, but that eventually fails due to class loader security restrictions in the receiving context. I am attempting to figure that problem out now.


              Here is the servlet code if anyone is interested. If anyone has a better idea feel free to throw it out here.


              package org.safmt.bigbro;
              
              import javax.servlet.ServletException;
              import javax.servlet.http.HttpServlet;
              import javax.servlet.http.HttpServletRequest;
              import javax.servlet.http.HttpServletResponse;
              
              import org.jboss.seam.contexts.Contexts;
              
              import org.safmt.bigbro.model.AuthUser;
              
              public final class AuthForwardServlet extends HttpServlet {
                      public void doGet(HttpServletRequest request, HttpServletResponse response) {
                              HttpServletRequest req = (HttpServletRequest) request;
                              req.setAttribute("user", Contexts.getConversationContext().get("auser")));
              
                              try {
                                  req.getSession().getServletContext().getContext("/SecureMail")
                                      .getRequestDispatcher("/Login.do").forward(req, response);
                              } catch (ServletException e) {
                                  e.printStackTrace();
                              } catch (IOException e) {
                                  e.printStackTrace();
                              }
                      }
              }