[seam-dev] RedirectHelper (Faces) or RedirectBuilder (Servlet)

Lincoln Baxter, III lincolnbaxter at gmail.com
Tue Aug 30 13:18:03 EDT 2011


You could also do this by invoking the Faces NavigationHandler with
query-parameters ?faces-redirect=true

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.

On Mon, Aug 15, 2011 at 1:25 PM, Brian Leathem <bleathem at gmail.com> wrote:

> On 11-08-12 06:50 PM, Cody Lerum wrote:
> > I have a particular use case where I need to:
> >
> > 1. End the current conversation if it exists
> > 2. Redirect to a specific view-id
> > 3. Optionally pass along some parameters.
> >
> > This led me to create new RedirectHelper for Seam Faces that allows me
> > to do something like this.
> >
> >
> redirectHelper.viewId("/admin/user.xhtml").param("oid",100).endConversation().redirect();
> >
> > After doing so George Gastaldi and I found that this was partially
> > available in Seam Servlet through RedirectBuilder and can accomplish
> > the same like this.
> >
> > redirectBuilder.redirect(request.get().getContextPath() +
> > "/admin/user.xhtml").param("oid", 100).send();
> >
> > The only hang-ups being that it doesn't have support conversation
> > control (yet) and also assumes that if I have a "/" at the start of my
> > view-id that it is absolute and not to include the ContextPath. In
> > faces however I expect that the ContextPath will be added
> > ("localhost:8080/myApp/admin/home.xhtml"). IMHO RedirectBuilder just
> > seems like it would be a little rougher to a new faces user too.
>
> In addition, you don't know what the Faces Servlet mapping is, so you
> could have to deal with arbitrary prefixes and extensions at the URL level.
>
> > Does it make sense to alter the Seam Servlet RedirectBuilder to handle
> > these additional functions, or should I keep RedirectHelper in Faces
> > and have it be a softer way for users to work when redirecting within
> > JSF? I can utilize RedirectBuilder to handle the actual redirect in
> > the impl.
>
> I'd suggest building something in Faces that builds on top of what is in
> Seam Servlet.  Map the viewId to the URL using the facesContext, then
> delegate the rest of the url building to the Servlet RedirectBuilder.
>
> Thanks for contributing this helper code back into the project!
>
> Brian
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>



-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20110830/1f3261df/attachment.html 


More information about the seam-dev mailing list