Created
December 9, 2011 02:29
-
-
Save takezoe/1449859 to your computer and use it in GitHub Desktop.
XML response with Unfiltered
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unfiltered.request._ | |
import unfiltered.response._ | |
import scala.xml._ | |
case class Xml(nodes: NodeSeq) | |
extends ComposeResponse(TextXmlContent ~> ResponseString(nodes.toString)) | |
// Usage | |
def intent = { | |
case GET(Path(Seg("hello" :: name :: Nil))) => { | |
Ok ~> Xml(<hello>{name}</hello>) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これだと中でHtmlContentがチェインされているのでContent-Typeがtext/htmlになってしまうのです…。