John Nilsson wrote:
> On Sun, Nov 9, 2008 at 1:13 PM, Tim Perrett <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
>     Hey John,
>
>     I take your point for sure - the only thing id say on this would be
>     that there is argument (both for and against) of holding this type of
>     resource representation in the request metadata as opposed to the
>     concrete URI. Both ways are "restfull" as it were, id say its a matter
>     of preference / use case. I need to check, but If you wanted to set
>     the accept and content-type headers we have this partial function in
>     lift rules:
>
> I aggree on the preference part. I'm still curious towards the 
> argument though :)
>
>
>     var determineContentType: PartialFunction[(Can[RequestState],
>     Can[String]), String] = {
>        case (_, Full(accept)) if this.useXhtmlMimeType &&
>     accept.toLowerCase.contains("application/xhtml+xml") => "application/
>     xhtml+xml"
>        case _ => "text/html"
>     }
>
> Is that lowlevel Lift code or supposed to be how you use the API?
This is the default code for how Lift determines content type for 
returning code from XHTML pages (the main render pipeline).

The code was copied and pasted from LiftRules.

>
> If it's the latter I think there's some improvements that can be done ;)
Um... and how would you change it?

On a broader note, pattern matching against the vagaries of the 
"accepts" header is far less clean than pattern matching against the 
suffix of a request.  I think Rails got it right in terms of using the 
suffix of the request and Lift follows Rails in this being the "easy path":

case RequestState("api" :: "myservice" :: Nil, "js", GetReqeust) =>

vs.

case RequestState("api" :: "myservice" :: Nil, _, GetRequest) if 
acceptsJavaScript =>

Thanks,

David

>
> BR,
> John
>
> >

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to