abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r429409 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol: cache/CacheBase.java cache/InMemoryCache.java client/RequestOptions.java client/ResponseBase.java
Date Mon, 07 Aug 2006 17:36:02 GMT
Author: jmsnell
Date: Mon Aug  7 10:36:02 2006
New Revision: 429409

URL: http://svn.apache.org/viewvc?rev=429409&view=rev
Log:
Had a bit of a brain fart on the bitwise operators

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
Mon Aug  7 10:36:02 2006
@@ -122,6 +122,10 @@
     RequestOptions options,
     Response response) {
     CacheKey key = getCacheKey(uri, options,response);
+System.out.println(response);
+System.out.println(response.isNoStore());
+System.out.println(options);
+System.out.println(options.getNoStore());
     if ((response != null && response.isNoStore()) ||
         options != null && options.getNoStore()) {
      remove(key);

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
Mon Aug  7 10:36:02 2006
@@ -46,7 +46,7 @@
   }
 
   public CachedResponse get(
-    CacheKey key) {
+    CacheKey key) {   
       return cache.get(key);
   }
 

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
Mon Aug  7 10:36:02 2006
@@ -230,7 +230,7 @@
   
   public void setOnlyIfCached(boolean condition) {
     if (condition) flags |= ONLYIFCACHED;
-    else flags ^= ONLYIFCACHED;
+    else if (getOnlyIfCached()) flags ^= ONLYIFCACHED;
   }
   
   public boolean getNoTransform() {
@@ -239,7 +239,7 @@
   
   public void setNoTransform(boolean condition) {
     if (condition) flags |= NOTRANSFORM;
-    else flags ^= NOTRANSFORM;
+    else if (getNoTransform()) flags ^= NOTRANSFORM;
   }
   
   public boolean getNoCache() {
@@ -248,7 +248,7 @@
   
   public void setNoCache(boolean condition) {
     if (condition) flags |= NOCACHE;
-    else flags ^= NOCACHE;
+    else if (getNoCache()) flags ^= NOCACHE;
   }
   
   public boolean getNoStore() {
@@ -257,7 +257,7 @@
   
   public void setNoStore(boolean condition) {
     if (condition) flags |= NOSTORE;
-    else flags ^= NOSTORE;
+    else if (getNoStore()) flags ^= NOSTORE;
   }
   
   public long getMaxAge() {

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java
Mon Aug  7 10:36:02 2006
@@ -29,13 +29,13 @@
 
 public abstract class ResponseBase implements Response {
 
-  protected byte flags = 0;
-  protected final static byte NOCACHE = 1;
-  protected final static byte NOSTORE = 2;
-  protected final static byte NOTRANSFORM = 4;
-  protected final static byte PUBLIC = 8;
-  protected final static byte PRIVATE = 16;
-  protected final static byte REVALIDATE = 32;
+  protected int flags = 0;
+  protected final static int NOCACHE = 1;
+  protected final static int NOSTORE = 2;
+  protected final static int NOTRANSFORM = 4;
+  protected final static int PUBLIC = 8;
+  protected final static int PRIVATE = 16;
+  protected final static int REVALIDATE = 32;
   protected String[] nocache_headers = null;
   protected String[] private_headers = null;
   protected long max_age = -1;
@@ -155,32 +155,32 @@
   
   public void setMustRevalidate(boolean val) {
     if (val) flags |= REVALIDATE;
-    else flags ^= REVALIDATE;
+    else if (isMustRevalidate()) flags ^= REVALIDATE;
   }
   
   public void setNoCache(boolean val) {
     if (val) flags |= NOCACHE;
-    else flags ^= NOCACHE;
+    else if (isNoCache()) flags ^= NOCACHE;
   }
   
   public void setNoStore(boolean val) {
     if (val) flags |= NOSTORE;
-    else flags ^= NOSTORE;
+    else if (isNoStore()) flags ^= NOSTORE;
   }
   
   public void setNoTransform(boolean val) {
     if (val) flags |= NOTRANSFORM;
-    else flags ^= NOTRANSFORM;
+    else if (isNoTransform()) flags ^= NOTRANSFORM;
   }
   
   public void setPublic(boolean val) {
     if (val) flags |= PUBLIC;
-    else flags ^= PUBLIC;
+    else if (isPublic()) flags ^= PUBLIC;
   }
   
   public void setPrivate(boolean val) {
     if (val) flags |= PRIVATE;
-    else flags ^= PRIVATE;
+    else if (isPrivate()) flags ^= PRIVATE;
   }
   
   public void setPrivateHeaders(String... headers) {



Mime
View raw message