On Mon, Nov 10, 2008 at 10:32 AM, John Nilsson <[EMAIL PROTECTED]> wrote:
>
>
>
>
>>
>>
>>
>>>
>>> case RequestState("api" :: "myservice" :: Nil, "js", GetReqeust) =>
>>>
>>> vs.
>>>
>>> case RequestState("api" :: "myservice" :: Nil, _, GetRequest) if
>>> acceptsJavaScript =>
>>>
>>
>> I'm not saying it's wrong to base decisions on the URL. But the
>> framework probably shouldn't put to much semantics into the URL. It should
>> let the application do it, as per the example above though. For accept
>> headers the framework should have more freedom to provide an easi API.
>>
>> The framework *DOES NOT* put the semantics in the URL. This is *ALL* how
>> a given application registers how to handle particular requests. This is
>> *ALL* application level.
>>
> From the example code I got the impression that the second parameter to
> RequestState was exactly the suffix of the URL
>
It is.
> , separated by the framework and presented as an API. The general
> consequence being that the framework puts focus on the URL-suffix rather
> than the Accept header.
>
It gives the developer more latitude.
If Lift did not separate out the suffix, but one had external APIs that rely
on suffixes (e.g., Twitter), one would wind up with code that looks like:
case Req("api" :: "my_call.xml" :: Nil, GetRequest) => doMyCall("xml")
case Req("api" :: "my_call.js" :: Nil, GetRequest) => doMyCall("js")
vs.
case Req("api" :: "my_call" :: Nil, suffix, GetRequest) => doMyCall(suffix)
So, the cost to the "non-suffix" crowd is typing ", _" in each pattern. The
value to the suffix crowd is very high.
The framework makes one thing easier with very little cost to doing the
thing another way.
> Which I think your example also ilustrates. Was it not your point to argue
> that the API for handling the Accept header is harder to use?
>
No. My point was that Lift make common things easier and it strives for
flexibility by replacing raw string matching with more flexible pattern
matching.
Thanks,
David
>
>
> BR,
> John
>
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---