You could also do this by invoking the Faces NavigationHandler with query-parameters ?faces-redirect=true<br><br>And additional values that were passed. I think that would be the most stable for JSF, but if you also want it to handle servlets, then maybe what you are suggesting is better, just skipping JSF.<br>
<br><div class="gmail_quote">On Mon, Aug 15, 2011 at 1:25 PM, Brian Leathem <span dir="ltr"><<a href="mailto:bleathem@gmail.com">bleathem@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 11-08-12 06:50 PM, Cody Lerum wrote:<br>
> I have a particular use case where I need to:<br>
><br>
> 1. End the current conversation if it exists<br>
> 2. Redirect to a specific view-id<br>
> 3. Optionally pass along some parameters.<br>
><br>
> This led me to create new RedirectHelper for Seam Faces that allows me<br>
> to do something like this.<br>
><br>
> redirectHelper.viewId("/admin/user.xhtml").param("oid",100).endConversation().redirect();<br>
><br>
> After doing so George Gastaldi and I found that this was partially<br>
> available in Seam Servlet through RedirectBuilder and can accomplish<br>
> the same like this.<br>
><br>
> redirectBuilder.redirect(request.get().getContextPath() +<br>
> "/admin/user.xhtml").param("oid", 100).send();<br>
><br>
> The only hang-ups being that it doesn't have support conversation<br>
> control (yet) and also assumes that if I have a "/" at the start of my<br>
> view-id that it is absolute and not to include the ContextPath. In<br>
> faces however I expect that the ContextPath will be added<br>
> ("localhost:8080/myApp/admin/home.xhtml"). IMHO RedirectBuilder just<br>
> seems like it would be a little rougher to a new faces user too.<br>
<br>
</div>In addition, you don't know what the Faces Servlet mapping is, so you<br>
could have to deal with arbitrary prefixes and extensions at the URL level.<br>
<div class="im"><br>
> Does it make sense to alter the Seam Servlet RedirectBuilder to handle<br>
> these additional functions, or should I keep RedirectHelper in Faces<br>
> and have it be a softer way for users to work when redirecting within<br>
> JSF? I can utilize RedirectBuilder to handle the actual redirect in<br>
> the impl.<br>
<br>
</div>I'd suggest building something in Faces that builds on top of what is in<br>
Seam Servlet. Map the viewId to the URL using the facesContext, then<br>
delegate the rest of the url building to the Servlet RedirectBuilder.<br>
<br>
Thanks for contributing this helper code back into the project!<br>
<font color="#888888"><br>
Brian<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
seam-dev mailing list<br>
<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Lincoln Baxter, III<br><a href="http://ocpsoft.com">http://ocpsoft.com</a><br><a href="http://scrumshark.com">http://scrumshark.com</a><br>"Keep it Simple"<br>