[ http://mc4j.org/jira/browse/STS-262?page=comments#action_10726 ]
Ben Gunter commented on STS-262:
--------------------------------
Sorry, I was tired and didn't want to take the time to explain. Here's an
example of where it causes a little trouble at the moment. Say you map a bean
like so:
@UrlBinding("/action/blog/{_eventName}/{blogEntry}")
And somewhere you redirect to it like so:
return new RedirectResolution(BlogBean.class, "view").addParameter("blogEntry",
12345);
OnwardResolution will just create a parameter called "view" with an empty
value, which will result in a redirect to:
/action/blog?view=&blogEntry=12345
By using the special parameter $event, you could map the bean like this:
@UrlBinding("/action/blog/{$event}/{blogEntry}")
And the resulting URL should look like this instead:
/action/blog/view/12345
The difference being that instead of creating an empty parameter named "view",
it sets the $event parameter to the *value* "view".
Unfortunately, using _eventName doesn't exactly solve this problem. Instead of
this:
new RedirectResolution(BlogBean.class, "view")
you currently have to do this instead:
new RedirectResolution(BlogBean.class).addParameter("_eventName", "view")
But like I said in my previous comment, I intend to get this fixed soon. I'll
have to make UrlBuilder aware of events and how to handle them when
constructing the URL. What used to be such a simple class has gotten so much
more complex in the last week or two :)
> Friendly URL support
> --------------------
>
> Key: STS-262
> URL: http://mc4j.org/jira/browse/STS-262
> Project: Stripes
> Issue Type: New Feature
> Components: ActionBean Dispatching
> Reporter: Tim Fennell
> Assigned To: Ben Gunter
> Fix For: Release 1.5
>
> Attachments: cleanurls-patches.zip, cleanurls-src-01182007.zip
>
>
> One thing that comes up frequently is support for friendly URLs, e.g.:
> /blog/2006/08/22
> /user/6282/edit
> and so on. While it's possible to acheive URLs like this using 3rd party
> tools like UrlRewriteFilter it would be nice if they were built directly into
> stripes because then all URL information could be kept in a single place for
> each class.
> I'm envisaging an annotation something like this:
> @UrlInfo("/{year}/{month}/{day}")
> @UrlInfo("/{userId}/{event}")
> that would inform Stripes how to map the extra pieces of information encoded
> in the URL.
> Optionally this could also be specified with the existing UrlBinding
> annotations, e.g.
> @UrlBinding("/blog/{year}/{month}/{day}")
> If done right, the stripes url and link tags could also take advantage of
> this information to put certain parameters into the URL instead of a
> parameter string.
> I'm very open to hearing alternative ideas around how to specify this, and
> other functionality that would be desirable.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development