--- a/src/main/scala/Lang.scala Tue Jun 26 23:05:11 2012 +0200
+++ b/src/main/scala/Lang.scala Wed Jun 27 15:47:56 2012 +0200
@@ -40,15 +40,17 @@
val default = RDFXML
- def apply(contentType: String): Option[Lang] =
- contentType.trim.toLowerCase match {
- case "text/n3" => Some(N3)
- case "text/turtle" => Some(TURTLE)
- case "application/rdf+xml" => Some(RDFXML)
- case "text/html" => Some(HTML)
- case "application/xhtml+xml" => Some(XHTML)
- case _ => None
- }
+ def apply(contentType: String): Option[Lang] = {
+ val ct = contentType.split(";")(0)
+ ct.trim.toLowerCase match {
+ case "text/n3" => Some(N3)
+ case "text/turtle" => Some(TURTLE)
+ case "application/rdf+xml" => Some(RDFXML)
+ case "text/html" => Some(HTML)
+ case "application/xhtml+xml" => Some(XHTML)
+ case _ => None
+ }
+ }
def apply(cts: Iterable[String]): Option[Lang] =
cts map Lang.apply collectFirst { case Some(lang) => lang }
--- a/src/main/scala/RequestLang.scala Tue Jun 26 23:05:11 2012 +0200
+++ b/src/main/scala/RequestLang.scala Wed Jun 27 15:47:56 2012 +0200
@@ -32,8 +32,10 @@
def apply(req: HttpRequest[_]): Option[Lang] =
Lang(RequestContentType(req))
- def unapply(req: HttpRequest[_]): Option[Lang] =
- Lang(RequestContentType(req))
+ def unapply(req: HttpRequest[_]): Option[Lang] = {
+ val res = Lang(RequestContentType(req))
+ res
+ }
def unapply(ct: String): Option[Lang] =
Lang(ct)