1 23 24 package com.sun.appserv.web.cache.filter; 25 26 import java.util.HashMap ; 27 import java.util.ArrayList ; 28 import java.util.Locale ; 29 30 38 public class HttpCacheEntry { 39 40 public static final int VALUE_NOT_SET = -1; 41 42 int statusCode; 43 String statusMessage; 44 45 HashMap responseHeaders; 46 HashMap dateHeaders; 47 ArrayList cookies; 48 String contentType; 49 Locale locale; 50 51 int contentLength; 52 53 byte[] bytes; 55 56 int timeout; 57 volatile long expireTime = 0; 58 59 63 public void setExpireTime(long expireTime) { 64 this.expireTime = expireTime; 65 } 66 67 72 public void computeExpireTime(int timeout) { 73 this.timeout = timeout; 74 75 this.expireTime = (timeout == -1) ? timeout : 77 System.currentTimeMillis() + (timeout * 1000); 78 } 79 80 83 public boolean isValid() { 84 return (expireTime > System.currentTimeMillis() || expireTime == -1); 85 } 86 87 90 public void clear() { 91 bytes = null; 92 responseHeaders = null; 93 cookies = null; 94 } 95 96 101 public int getSize() { 102 int size = 0; 103 if (bytes != null) { 104 size = bytes.length; 105 } 106 107 return (size + (40 * responseHeaders.size()) ); 109 } 110 } 111 | Popular Tags |