changeset 14:dfc3f2700da3

+ ResponseCache.scala
author Alexandre Bertails <bertails@w3.org>
date Tue, 02 Mar 2010 15:08:04 -0500
parents 531e7f7a9688
children b8d7acb0f7b2
files src/main/scala/ResponseCache.scala
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/ResponseCache.scala	Tue Mar 02 15:08:04 2010 -0500
@@ -0,0 +1,23 @@
+package org.w3.util
+
+import java.net._
+import java.io._
+
+case class CachedResponse(in:InputStream) extends CacheResponse {
+  def getBody() = in
+  def getHeaders() = null
+}
+
+object CachedResponse {
+  def apply(file:File):CachedResponse = CachedResponse(new FileInputStream(file))
+  def apply(filename:String):CachedResponse = CachedResponse(new File(filename))
+}
+
+object CatalogLike extends ResponseCache {
+  def get(uri:URI, rqstMethod:String, rqstHeaders:java.util.Map[java.lang.String,java.util.List[java.lang.String]]) =
+    uri.toString match {
+      case "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" => CachedResponse("dtds/xhtml1-strict.dtd")
+      case _ => null
+    }
+  def put(uri:URI, conn:URLConnection) = null
+}
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.