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

Cody Lerum cody.lerum at gmail.com
Fri Aug 12 21:50:28 EDT 2011


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.

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.

Thoughts?


More information about the seam-dev mailing list