1 16 package org.apache.cocoon.caching; 17 18 import java.io.Serializable ; 19 20 import org.apache.excalibur.source.SourceValidity; 21 22 33 public class CachedResponse 34 implements Serializable { 35 36 protected final SourceValidity[] validityObjects; 37 protected final byte[] response; 38 protected Long expires; 39 protected final long lastModified; 40 protected String contentType; 41 42 49 public CachedResponse(SourceValidity[] validityObjects, 50 byte[] response) { 51 this(validityObjects, response, null); 52 } 53 54 60 public CachedResponse(SourceValidity validityObject, 61 byte[] response) { 62 this(new SourceValidity[] {validityObject}, response, null); 63 } 64 65 74 public CachedResponse(SourceValidity[] validityObjects, 75 byte[] response, 76 Long expires) { 77 this.validityObjects = validityObjects; 78 this.response = response; 79 this.expires = expires; 80 this.lastModified = this.setLastModified(System.currentTimeMillis()); 81 } 82 83 86 public SourceValidity[] getValidityObjects() { 87 return this.validityObjects; 88 } 89 90 95 public byte[] getResponse() { 96 return this.response; 97 } 98 99 104 public Long getExpires() { 105 return this.expires; 106 } 107 108 112 public void setExpires(Long newExpires) { 113 this.expires = newExpires; 114 } 115 116 120 protected long setLastModified(long lastModified) { 121 return lastModified - (lastModified % 1000); 123 } 124 125 128 public long getLastModified() { 129 return lastModified; 130 } 131 132 135 public String getContentType() { 136 return this.contentType; 137 } 138 141 public void setContentType(String value) { 142 this.contentType = value; 143 } 144 } 145 | Popular Tags |