Hi Tim

Sounds very reasonable :)

/Jeppe
-----Original message-----
From: Tim Fennell [EMAIL PROTECTED]
Date: Mon, 28 May 2007 16:33:31 +0200
To: Stripes Development List [email protected]
Subject: Re: [Stripes-dev] clean URLs

> My take on this is that Stripes should prefer friendly URLs if they  
> are configured.  To generalize this a bit, let's assume we continue  
> to use @UrlBinding, and I'll give some examples of how I think this  
> should work:
> 
> #1 UrlBinding("/foo/{$event}/${date}")
>    #1a    desc: vanilla clean URL
>         params: event->view, date->2007-05-26
>            url: /foo/view/2007-05-26
> 
>    #1b    desc: clean url with additional param
>         params: event->view, date->2007-05-26, keyword=mac
>            url: /foo/view/2007-05-26?keyword=mac
> 
>    #1c    desc: first param not provided
>         params: date->2007-05-26, keyword=mac
>            url: /foo?date=2007-05-26&keyword=mac
> 
> So, to generalize, I'd expect a strategy something like the following  
> to construct a URL from a UrlBinding:
> 1: take everything to the left of the first parameter
> 2: from right to left, for params in the /path/, if the next  
> parameter has a value supplied, insert into the path, else goto #3
> 3: write remaining parameters as a regular query string
> 
> Does this sound reasonable to everyone?  Or am I missing a case?
> 
> -t
> 
> On May 28, 2007, at 8:28 AM, Kai Grabfelder wrote:
> 
> > Hm,
> >
> > I don't see why I want to change the URLBinding if I add a new
> > property to my action bean. Property Binding in the normal way
> > (QueryString parameter) should always be possible as well.
> >
> > Whenever an application goes to production URLBindings should not be
> > changed anyway because for the sake of SEO and user friendly URLs
> > should hardly never ever change.
> >
> > Of course you are right, that clean urls are not that necessary for
> > intranets but as long as they mean not any extra work they still
> > could be used imo...
> >
> > cheers
> >
> > Kai
> >
> >
> > --- Original Nachricht ---
> > Absender: VANKEISBELCK Remi
> > Datum: 28.05.2007 13:53
> >> Well, it has side effects actually...
> >>
> >> For example, when you add a property to your action and want it  
> >> bound,
> >> you have to get back to your @UrlBinding and change what's in  
> >> there...
> >> Also, depending on the usage of your action bean, you may have
> >> different parameter expectations that would not be usable with clean
> >> URLs, as the parameters are "frozen" in the @UrlBinding.
> >>
> >> IMO, clean URLs are a requirement that everybody doesn't have. I  
> >> never
> >> use them when building intranets for example, as the app is not
> >> supposed to be crawled by search engines, and anyway the URLs are too
> >> complex to be "clean" (dynamic parameters and the like).
> >> So for folks like you who need this on all their GETs, maybe a config
> >> param for <s:link/url> would be ok ? So that when you ask for a link
> >> or url in your page, then the clean url is used. Otherwise, in  
> >> case of
> >> POSTs and when you specifically tell Stripes that the url doesn't  
> >> have
> >> to be clean, the ugly one is used.
> >>
> >> What do you think ?
> >>
> >> Cheers
> >>
> >> Remi
> >>
> >> On 5/26/07, Newman, John W <[EMAIL PROTECTED]> wrote:
> >>> I personally think clean should be the default, or even the only  
> >>> way to do it.  I will certainly use this 100% of the time, I  
> >>> can't see any reason to use an ugly url if the facility to build  
> >>> a clean one is that easy to use.
> >>>
> >>> John
> >>>
> >>>
> >>> -----Original Message-----
> >>> From: [EMAIL PROTECTED] on behalf  
> >>> of Ben Gunter
> >>> Sent: Sat 5/26/2007 10:35 AM
> >>> To: [EMAIL PROTECTED]; Stripes Development List
> >>> Subject: Re: [Stripes-dev] clean URLs
> >>>
> >>> I want to say it should require a separate annotation, but I  
> >>> can't come
> >>> up with a good reason why. I guess that means we should just use
> >>> @UrlBinding.
> >>>
> >>> -Ben
> >>>
> >>> VANKEISBELCK Remi wrote:
> >>>> Hi Kai (and other UrlBinding fans ;-P),
> >>>>
> >>>> Well, it's true that my own version works like you describe, and  
> >>>> it's fine...
> >>>>
> >>>> Hmmm, frankly speaking I don't really know. You folks seem to be  
> >>>> right
> >>>> : why another annotation when one is enough ? Clarity ? Well,  
> >>>> finally
> >>>> you'd also notice the "clean" thingy at first glance, based on  
> >>>> what's
> >>>> inside @UrlBinding...
> >>>>
> >>>> Ben ? What's your take on this ?
> >>>>
> >>>> Cheers
> >>>>
> >>>> Remi
> >>>>
> >>>> On 5/25/07, Kai Grabfelder <[EMAIL PROTECTED]> wrote:
> >>>>
> >>>>> Remi,
> >>>>>
> >>>>> I'm still wondering why anybody wants to specify multiple url
> >>>>> annotations at one bean? I tend to agree with Barry that just ony
> >>>>> URLBinding (may it be "clean" or not) annotation is enough. Other
> >>>>> frameworks (for example symfony) do it this way as well.
> >>>>>
> >>>>> A "clean" url may not be necessary for POST requests / forms but
> >>>>> it's not bad either, isn't it?
> >>>>>
> >>>>> cheers
> >>>>>
> >>>>> Kai
> >>>>>
> >>>>>
> >>>>> --- Original Nachricht ---
> >>>>> Absender: VANKEISBELCK Remi
> >>>>> Datum: 25.05.2007 16:30
> >>>>>
> >>>>>> Hey Barry,
> >>>>>>
> >>>>>> Well, it's only an additional feature : the existing  
> >>>>>> @UrlBinding +
> >>>>>> everything related is already fine and we don't want to change  
> >>>>>> that.
> >>>>>> The "beanclass" stuff would just use either @UrlBinding or  
> >>>>>> @CleanUrl,
> >>>>>> depending on what you ask,, e.g. :
> >>>>>> <s:form beanclass="..."> -> uses regular UrlBinding as FORMs  
> >>>>>> usually
> >>>>>> don't need to be "clean"
> >>>>>> <s:link beanclass="..."> -> uses CleanUrl as links are  
> >>>>>> supposed to be
> >>>>>> clean if the bean class has the @CleanUrl annotation, unless you
> >>>>>> specify e.g. clean="false".
> >>>>>>
> >>>>>> IMHO, adding this to the existing @UrlBinding, it would make the
> >>>>>> annotation more complex, without being really more convenient :
> >>>>>>
> >>>>>> @UrlBinding(value="/my/stuff.action", clean="/my/stuff/{p1}/...")
> >>>>>> or
> >>>>>> @UrlBinding("/my/stuff.action")
> >>>>>> @CleanUrl("/my/stuff/{p1}/...")
> >>>>>>
> >>>>>> The second option looks more readable and expressive to me...  
> >>>>>> And once
> >>>>>> again @CleanUrl is a feature you want to add to your action  
> >>>>>> bean, so
> >>>>>> having it as a separate annotation is OK as far as I see.  
> >>>>>> Annotate to
> >>>>>> add features, that sticks to the Stripes spirit if I'm right :-)
> >>>>>>
> >>>>>> Cheers
> >>>>>>
> >>>>>> Remi
> >>>>>>
> >>>>>> On 5/25/07, Barry Davies <[EMAIL PROTECTED]> wrote:
> >>>>>>
> >>>>>>> All these ideas are making me very much look forward to using  
> >>>>>>> this
> >>>>>>> feature--the ideas seem very promising.  My knee-jerk  
> >>>>>>> responses would be to
> >>>>>>> want classic-urls and clean-urls to both be configured using  
> >>>>>>> @UrlBinding.
> >>>>>>> Can you have multiple @UrlBinding annotations for a single  
> >>>>>>> ActionBean right
> >>>>>>> now?  I thought you couldn't so that a beanclass uniquely  
> >>>>>>> implies a URL in
> >>>>>>> all cases.  If we're going to change the thinking behind  
> >>>>>>> that, we might as
> >>>>>>> well go whole-hog and allow any number of classic-url or  
> >>>>>>> clean-url bindings,
> >>>>>>> with one being the default and the others being able to be  
> >>>>>>> selected by name,
> >>>>>>> or some such.  What do you guys think?
> >>>>>>>
> >>>>>>> -BD aka RJ
> >>>>>>>
> >>>>>>>
> >>>>>>> ----- Original Message ----
> >>>>>>> From: VANKEISBELCK Remi <[EMAIL PROTECTED]>
> >>>>>>> To: Tim Fennell <[EMAIL PROTECTED]>
> >>>>>>> Cc: Stripes Development List
> >>>>>>> <[email protected]>
> >>>>>>> Sent: Friday, May 25, 2007 8:53:35 AM
> >>>>>>> Subject: Re: [Stripes-dev] clean URLs
> >>>>>>>
> >>>>>>> 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
> >>>>>>>
> >>>>>>>
> >>>>>>>  ________________________________
> >>>>>>> Need Mail bonding?
> >>>>>>> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers  
> >>>>>>> users.
> >>>>>>>
> >>>>>> ----------------------------------------------------------------- 
> >>>>>> --------
> >>>>>> 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
> 
> 
> -------------------------------------------------------------------------
> 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

Reply via email to