src/Pure/General/http.scala
changeset 65086 548efa2bda66
parent 65085 9d53b892140a
child 65087 11e332c4e39f
equal deleted inserted replaced
65085:9d53b892140a 65086:548efa2bda66
   128       else None)
   128       else None)
   129 
   129 
   130 
   130 
   131   /* fonts */
   131   /* fonts */
   132 
   132 
   133   private lazy val isabelle_fonts: SortedMap[String, Bytes] =
   133   private lazy val html_fonts: SortedMap[String, Bytes] =
   134     SortedMap(
   134     SortedMap(
   135       Isabelle_System.fonts(html = true).map(path => (path.base.implode -> Bytes.read(path))): _*)
   135       Isabelle_System.fonts(html = true).map(path => (path.base.implode -> Bytes.read(path))): _*)
   136 
   136 
   137   def fonts(root: String = "/fonts"): Handler =
   137   def fonts(root: String = "/fonts"): Handler =
   138   {
   138   {
   139     get(root, uri =>
   139     get(root, uri =>
   140       {
   140       {
   141         val uri_name = uri.toString
   141         val uri_name = uri.toString
   142         if (uri_name == root) Some(Response.text(cat_lines(isabelle_fonts.map(_._1))))
   142         if (uri_name == root) Some(Response.text(cat_lines(html_fonts.map(_._1))))
   143         else
   143         else html_fonts.collectFirst({ case (a, b) if uri_name == root + "/" + a => Response(b) })
   144           isabelle_fonts.collectFirst(
       
   145             { case (name, file) if uri_name == root + "/" + name => Response(file) })
       
   146       })
   144       })
   147   }
   145   }
   148 }
   146 }