Skip to content

Instantly share code, notes, and snippets.

@timperrett
Created August 6, 2010 10:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timperrett/511170 to your computer and use it in GitHub Desktop.
Save timperrett/511170 to your computer and use it in GitHub Desktop.
LiftRules.dispatch.append {
case r@Req("some" :: "path" :: Nil,"",GetRequest) => {
val accept = in.headers("accept")
(accept.find(_.toLowerCase.indexOf("text/xml") >= 0).isDefined ||
((in.path.suffix equalsIgnoreCase "xml") && (accept.isEmpty ||
accept.find(_.toLowerCase.indexOf("*/*") >= 0).isDefined)))
? Full(XmlResponse(...)) | Full(JsonReponse(...))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment