[ http://mc4j.org/jira/browse/STS-262?page=comments#action_10567 ] Remi VANKEISBELCK commented on STS-262: ---------------------------------------
Been reworking that a little... It was actually possible to decouple everything from Stripes : this new version allows to use clean URLs as a "plugin" (or "extension"), using a custom ActionResolver, Interceptor and request wrapper. I didn't realize this at first sight. The principle is still the same (I haven't changed the syntax, it's no big deal) : you define the clean URL expressions in the regular @UrlBinding annot, using '@' and ':' to specify the action's name as well as the request parameters, and your actions can handle clean URLs, with the binding etc. I've deployed a test page there : http://195.83.41.200/cleanurls And you can grab the WAR (including sources, look in WEB-INF/classes) there : http://jfacets.rvkb.com/pub/cleanurls.war All this is VERY simple (4 classes !!!). The process goes like this : 1/ Handle the request (e.g. http://.../myApp/actions/store/Book/1) 2/ CleanUrlActionResolver is used to locate the action bean 3/ The bean is obtained 4/ The CleanUrlInterceptor detects clean URL handling and thereby wraps the request (once more) and reassociates this new top-level wrapper to the current ActionBeanContext (@Before(HandlerResolution)) 5/ The top-level wrapper goes through the rest of the lifecycle and makes the clean URL thingy completely transparent : you just your the request the same way, and so does stripes, so binding, validation etc works. Check it out ! > 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: Tim Fennell > Fix For: Release 1.5 > > Attachments: cleanurls-patches.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 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Stripes-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-development
