[infinispan-commits] Infinispan SVN: r832 - trunk/server/rest/src/main/scala/org/infinispan/rest.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Sep 17 21:38:37 EDT 2009


Author: michael.neale at jboss.com
Date: 2009-09-17 21:38:37 -0400 (Thu, 17 Sep 2009)
New Revision: 832

Modified:
   trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala
Log:
MIMECacheEntry uses long as timestamp

Modified: trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala
===================================================================
--- trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala	2009-09-18 01:10:48 UTC (rev 831)
+++ trunk/server/rest/src/main/scala/org/infinispan/rest/Server.scala	2009-09-18 01:38:37 UTC (rev 832)
@@ -3,6 +3,7 @@
 import codehaus.jackson.map.ObjectMapper
 import com.thoughtworks.xstream.XStream
 import java.io._
+import java.util.Date
 import remoting.MIMECacheEntry
 import java.util.concurrent.TimeUnit
 import javax.ws.rs._
@@ -18,9 +19,10 @@
   def getEntry(@PathParam("cacheName") cacheName: String, @PathParam("cacheKey") key: String) = {
       ManagerInstance.getEntry(cacheName, key) match {
         case b: MIMECacheEntry => {
-          request.evaluatePreconditions(b.lastModified, calcETAG(b)) match {
+          val lastMod = new Date(b.lastModified)
+          request.evaluatePreconditions(lastMod, calcETAG(b)) match {
             case bldr: ResponseBuilder => bldr.build
-            case null => Response.ok(b.data, b.contentType).lastModified(b.lastModified).tag(calcETAG(b)).build
+            case null => Response.ok(b.data, b.contentType).lastModified(lastMod).tag(calcETAG(b)).build
           }
         }
         case s: String => Response.ok(s, "text/plain").build
@@ -53,9 +55,10 @@
   def headEntry(@PathParam("cacheName") cacheName: String, @PathParam("cacheKey") key: String) = {
       ManagerInstance.getEntry(cacheName, key) match {
         case b: MIMECacheEntry => {
-          request.evaluatePreconditions(b.lastModified, calcETAG(b)) match {
+          val lastMod = new Date(b.lastModified)
+          request.evaluatePreconditions(lastMod, calcETAG(b)) match {
             case bldr: ResponseBuilder => bldr.build
-            case null => Response.ok.`type`(b.contentType).lastModified(b.lastModified).tag(calcETAG(b)).build
+            case null => Response.ok.`type`(b.contentType).lastModified(lastMod).tag(calcETAG(b)).build
           }
         }
         case x: Any => Response.ok.build
@@ -108,7 +111,7 @@
   }
 
   def calcETAG(entry: MIMECacheEntry) = {
-    new EntityTag(entry.contentType + entry.lastModified.getTime  + entry.data.length)
+    new EntityTag(entry.contentType + entry.lastModified  + entry.data.length)
 
   }
 



More information about the infinispan-commits mailing list