com.litongjava.tio.http.server.handler.FileCache Maven / Gradle / Ivy
package com.litongjava.tio.http.server.handler;
import com.litongjava.tio.http.common.HttpRequest;
import com.litongjava.tio.http.common.HttpResponse;
/**
* @author tanyaowu
* 2017年8月15日 下午5:44:52
*/
public class FileCache implements java.io.Serializable {
private static final long serialVersionUID = 6517890350387789902L;
// private static Logger log = LoggerFactory.getLogger(FileCache.class);
// this.addHeader(HttpConst.ResponseHeaderKey.Content_Encoding, "gzip");
// private Map headers = null;
private long lastModified;
// private byte[] data;
private HttpResponse response;
// /**
// * 是否已经被gzip压缩过了,防止重复压缩
// */
// private boolean hasGzipped = false;
/**
*
* @author tanyaowu
*/
public FileCache() {
}
public FileCache(HttpResponse response, long lastModified) {
super();
this.response = response;
// this.setHeaders(headers);
this.lastModified = lastModified;
// this.data = data;
}
// public byte[] getData() {
// return data;
// }
// public Map getHeaders() {
// return headers;
// }
public long getLastModified() {
return lastModified;
}
// public void setData(byte[] data) {
// this.data = data;
// }
// public void setHeaders(Map headers) {
// this.headers = headers;
// }
public void setLastModified(long lastModified) {
this.lastModified = lastModified;
}
public HttpResponse getResponse() {
return response;
}
public void setResponse(HttpResponse response) {
this.response = response;
}
public HttpResponse cloneResponse(HttpRequest request) {
// HttpResponse responseInCache = fileCache.getResponse();
HttpResponse ret = new HttpResponse(request);
ret.setBody(response.getBody());
ret.setHasGzipped(response.hasGzipped());
ret.addHeaders(response.getHeaders());
return ret;
}
// public boolean isHasGzipped() {
// return hasGzipped;
// }
//
// public void setHasGzipped(boolean hasGzipped) {
// this.hasGzipped = hasGzipped;
// }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy