Eh eh, excellent...
I would have done it like :
@CleanUrl("/my/action/{foo}/{bar}/{_eventName}")
:-)
Cheers
Remi
On 5/25/07, Ben Gunter <[EMAIL PROTECTED]> wrote:
> Oh, I forgot to mention that we can define special parameter names that
> start with $. The one I have implemented now is $event. You would use it
> like so:
>
> @CleanUrl("/my/action/{foo}/{bar}/{$event}")
>
> Then a link like /my/action/flibbity/flop/view would fire the "view"
> event on the ActionBean. One called $defaultUrl or something similar
> might also be useful:
>
> @UrlBinding("/my/action")
> @CleanUrl("$defaultUrl/{foo}/{bar}")
>
> Where the clean URL would map to whatever was specified in @UrlBinding
> or to the default URL binding if no @UrlBinding is present. That's
> handled differently from special parameter names, though, so I haven't
> implemented it yet. I don't have any particular love for the name
> $defaultUrl so we can change that or even use some other notation
> altogether. Suggestions are welcome.
>
> -Ben
>
> Ben Gunter wrote:
> > I agree. The only reason it's a separate tag now is because it was a
> > whole separate project :)
> >
> > VANKEISBELCK Remi wrote:
> >
> >> As far as I see it, an additional annotation is OK. It's a specific
> >> feature that you add to your action bean, so it's worth it IMO.
> >>
> >> On the other hand, I second Tim's point on s:link/url. Another tag
> >> isn't necessary (and could be confusing), and I think we can rework
> >> the existign tags so that they handle this.
> >> You would then write your links and urls the same way, and configure
> >> which method you prefer as an attribute or as a global configuration
> >> setting.
> >>
> >> <s:link beanclass=".." clean="true"> // throws exception if bean
> >> doesn't have @CleanUrl
> >> my stuff
> >> <s:link param .../>
> >> </s:link>
> >>
> >> What do you think ?
> >>
> >> Cheers
> >>
> >> Remi
> >>
> >> On 5/25/07, Tim Fennell <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >>> Hey Guys,
> >>>
> >>> Ben: I very much like your approach. The only thing I'll say is that
> >>> having different annotations and link tags makes sense for an add-on,
> >>> but when we integrate this to the core - I'd love to see this "just
> >>> work" with s:link and s:url. The annotation - maybe it does make
> >>> sense to keep that separate? I'm probably not the best judge of how
> >>> people will want to use this stuff ;)
> >>>
> >>> -t
> >>>
> >>> On May 25, 2007, at 9:46 AM, Ben Gunter wrote:
> >>>
> >>>
> >>>
> >>>> Great! I'm glad you like it. Yes, you definitely can still use
> >>>> "normal"
> >>>> URLs and params and all that. You don't even have to match the
> >>>> @UrlBinding to the @CleanUrl if you don't want to.
> >>>>
> >>>> VANKEISBELCK Remi wrote:
> >>>>
> >>>>
> >>>>> Hey Ben,
> >>>>>
> >>>>> Cool !
> >>>>> I've just reopened my own version, and yours seems definitly better :
> >>>>> * you don't need another request wrapper (how could I miss the
> >>>>> ForwardResolution trick ? neat !)
> >>>>> * you don't need any action separator (use the whole prefix before
> >>>>> param declaration)
> >>>>> * you have the link tag that already works (I'm still doing ugly
> >>>>> stuff
> >>>>> like <a href="/my/stuff/${blah}/foo/${bar.id}">... !!)
> >>>>>
> >>>>> I'm voting for integration of your version :-)
> >>>>>
> >>>>> A major question though : is the "regular" way still working ? I
> >>>>> mean,
> >>>>> can you use the same action with @CleanUrl and @UrlBinding+ugly
> >>>>> params
> >>>>> ?
> >>>>> I like the fact that with the clean URLs I have, I can still use the
> >>>>> same beans with "ugly" urls...
> >>>>>
> >>>>> See ya
> >>>>>
> >>>>> Rémi
> >>>>>
> >>>>> On 5/25/07, Ben Gunter <[EMAIL PROTECTED]> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>> Remi, I know you have done some work on clean URLs. This is how I've
> >>>>>> implemented it. We can take what we like from our two
> >>>>>> implementations
> >>>>>> and incorporate it into Stripes.
> >>>>>>
> >>>>>> The ActionBean looks like this:
> >>>>>>
> >>>>>> @CleanUrl("/my/action/{state}/{city}")
> >>>>>> public class MyActionBean extends BaseActionBean {
> >>>>>> @Validate(required=true) private String state;
> >>>>>> @Validate(required=true) private String city;
> >>>>>>
> >>>>>> // ... other stuff
> >>>>>> }
> >>>>>>
> >>>>>>
> >>>>>> To create clean links to an ActionBean annotated with @CleanUrl, you
> >>>>>> would do this:
> >>>>>>
> >>>>>> <%@ taglib="sx" uri="http://stripes.sourceforge.net/stripes-
> >>>>>> extras.tld" %>
> >>>>>> <sx:clean-link
> >>>>>> beanclass="com.mycompany.stripes.action.MyActionBean">
> >>>>>> Atlanta, Georgia
> >>>>>> <s:param name="state">GA</s:param>
> >>>>>> <s:param name="city">Atlanta</s:param>
> >>>>>> </sx:clean-link>
> >>>>>>
> >>>>>> This would generate a link to /my/action/GA/Atlanta. That's
> >>>>>> pretty much
> >>>>>> all there is to using it.
> >>>>>>
> >>>>>> The clean links are handled by a Stripes Interceptor. At startup, it
> >>>>>> scans all ActionBeans for @CleanUrls and caches the mapping
> >>>>>> prefix (i.e.
> >>>>>> the longest literal string before the first parameter
> >>>>>> specification).
> >>>>>> For each request it checks to see if the URI has been mapped using
> >>>>>> @CleanUrl. If it does find one that matches, then it executes a
> >>>>>> ForwardResolution to the ActionBean's URL binding and adds the
> >>>>>> parameters to the forwarded request. After that it just proceeds
> >>>>>> like a
> >>>>>> normal request with binding, validation, and all the other good
> >>>>>> stuff.
> >>>>>>
> >>>>>> I'm still working out a couple of little kinks, but it is working
> >>>>>> well.
> >>>>>> I'm caching everything I can to optimize the performance.
> >>>>>>
> >>>>>> -Ben
> >>>>>>
> >>>>>> --------------------------------------------------------------------
> >>>>>> -----
> >>>>>> 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
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> ----
> >>>>> 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
> >>>>>
> >>>>>
> >>>>>
> >>>> ----------------------------------------------------------------------
> >>>> ---
> >>>> 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
> >>>>
> >>>>
> >>>
> >>>
> >> -------------------------------------------------------------------------
> >> 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
> >>
> >>
> >
> > -------------------------------------------------------------------------
> > 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
> >
>
-------------------------------------------------------------------------
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