[seam-dev] Can someone please take a look a this

lincolnbaxter at gmail.com lincolnbaxter at gmail.com
Sat Nov 22 23:21:29 EST 2008


Yes that's a good point, and you can still do a redirect after the POST if  
that's important in your design. From another perspective, also, posting  
back to the pretty URL allows you to remember the context for which your  
form is being posted. So instead of having to explicitly re-code the URL  
parameters into the form data, you can re-parse these values and provide a  
consistent context. This also prevents having to keep extra data stored in  
session, when request scope is actually desired.

On Nov 22, 2008 10:48pm, Gavin King <gavin at hibernate.org> wrote:
> Thanks for the note, Lincoln.
>
>
>
> But the purpose of the redirect is not just to have a pretty URL ...
>
> it's to make sure the browser refresh button performs a GET instead of
>
> rePOSTing the form. Right?
>
>
>
> On Sat, Nov 22, 2008 at 10:37 AM, Lincoln Baxter, III
>
> wrote:
>
> > Hi Guys,
>
> >
>
> > I'm the author of the PrettyFaces extension. I just thought I would  
provide
>
> > some explanation.
>
> > Currently, if you wish to create bookmarkable URLs in Seam, when you  
submit
>
> > a form with validation that fails, the form URL will display the JSF  
view ID
>
> > (eg. /faces/store/buy.jsf), at this point Seam will have to send a  
redirect
>
> > to the browser to redirect them back to the proper URL (eg. /store/buy).
>
> > This is alright, but it causes wasted bandwidth, increased client wait  
time,
>
> > and extra CPU usage. On a high-load system, this can matter a lot.
>
> >
>
> > My solution simply replaces the JSF view ID in the HTTP tag with the
>
> > mapped page URL. This saves a redirect on validation, and also when you  
wish
>
> > to redisplay the same page. (it also provides some other nice features,  
but
>
> > those aren't really important in what's different between it and Seam)
>
> >
>
> > My source is available here and is licensed under the GPL3. Most of  
what I
>
> > think you'd be interested in will be in the PrettyViewHandler class,  
which
>
> > is ... simple. Have at it.
>
> > http://ocpsoft.com/prettyfaces
>
> >
>
> > Let me know if you have any questions.
>
> > Thanks,
>
> > Lincoln
>
> >
>
> >  
---------------------------------------------------------------------------------------------------------------------
>
> >
>
> > There is a URL rewrite filter that was introduced in Seam 2.1 to
>
> >
>
> > accomplish roughly the same thing, which was implemented by Norman.
>
> > Taking a hint from JAX-RS, it's possible to define a pretty URL for a
>
> > view ID in the page descriptor that transposes path info into request
>
> > parameters.
>
> >
>
> > Example 1:
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > Example 2:
>
> >
>
> >
>
> >
>
> >
>
> >
> > value="#{blogEntry.id}"/>
>
> >
>
> >
>
> >
>
> >
>
> > So if anything, we likely want to look at what discrepancies remain
>
> > between the rewrite filter can do and what this guy is proposing.
>
> > Norman?
>
> >
>
> > -Dan
>
> >
>
> > On Thu, Nov 13, 2008 at 3:07 PM, Gavin King wrote:
>
> >> http://ocpsoft.com/uncategorized/jsf-get-bookmarkable-and-pretty-urls/
>
> >>
>
> >> Not sure what exactly they are doing, but perhaps we should steal
>
> >> code? Not sure...
>
> >>
>
> >> --
>
> >> Gavin King
>
> >> gavin.king at gmail.com
>
> >> http://in.relation.to/Bloggers/Gavin
>
> >> http://hibernate.org
>
> >> http://seamframework.org
>
> >> _______________________________________________
>
> >> seam-dev mailing list
>
> >> seam-dev at lists.jboss.org
>
> >> https://lists.jboss.org/mailman/listinfo/seam-dev
>
> >>
>
> >
>
> >
>
> >
>
> > --
>
> > Dan Allen
>
> > Software consultant | Author of Seam in Action
>
> >
>
> > http://mojavelinux.com
>
> > http://mojavelinux.com/seaminaction
>
> >
>
> > NOTE: While I make a strong effort to keep up with my email on a daily
>
> > basis, personal or other work matters can sometimes keep me away
>
> > from my email. If you contact me, but don't hear back for more than a  
week,
>
> > it is very likely that I am excessively backlogged or the message was
>
> > caught in the spam filters. Please don't hesitate to resend a message if
>
> > you feel that it did not reach my attention.
>
> >
>
>
>
>
>
>
>
> --
>
> Gavin King
>
> gavin.king at gmail.com
>
> http://in.relation.to/Bloggers/Gavin
>
> http://hibernate.org
>
> http://seamframework.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20081123/af6a8c8e/attachment.html 


More information about the seam-dev mailing list