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

Lincoln Baxter, III lincolnbaxter at gmail.com
Sat Nov 22 10:37:31 EST 2008


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 <form> 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:
   <page view-id="/search.xhtml">
      <rewrite pattern="/search/{searchPattern}"/>
      <rewrite pattern="/search"/>

      <param name="searchPattern" value="#{searchService.searchPattern}"/>

   </page>

Example 2:
    <page view-id="/entry.xhtml">
        <rewrite pattern="/entry/{blogEntryId}" />
        <rewrite pattern="/entry" />

        <param name="blogEntryId"
               value="#{blogEntry.id}"/>

        <action execute="#{entryAction.loadBlogEntry(blogEntry.id)}"/>
    </page>

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 <gavin at hibernate.org> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20081122/908c7c3f/attachment.html 


More information about the seam-dev mailing list