mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-10-06 12:40:22 -04:00
Moved old obsolete stuff to sandbox.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
package com.twelvemonkeys.servlet.cache;
|
||||
|
||||
import com.twelvemonkeys.lang.StringUtil;
|
||||
import com.twelvemonkeys.net.NetUtil;
|
||||
import com.twelvemonkeys.net.HTTPUtil;
|
||||
import com.twelvemonkeys.servlet.ServletResponseStreamDelegate;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
@@ -212,7 +212,7 @@ class CacheResponseWrapper extends HttpServletResponseWrapper {
|
||||
if (Boolean.FALSE.equals(cacheable)) {
|
||||
super.setDateHeader(pName, pValue);
|
||||
}
|
||||
cachedResponse.setHeader(pName, NetUtil.formatHTTPDate(pValue));
|
||||
cachedResponse.setHeader(pName, HTTPUtil.formatHTTPDate(pValue));
|
||||
}
|
||||
|
||||
public void addDateHeader(String pName, long pValue) {
|
||||
@@ -220,7 +220,7 @@ class CacheResponseWrapper extends HttpServletResponseWrapper {
|
||||
if (Boolean.FALSE.equals(cacheable)) {
|
||||
super.addDateHeader(pName, pValue);
|
||||
}
|
||||
cachedResponse.addHeader(pName, NetUtil.formatHTTPDate(pValue));
|
||||
cachedResponse.addHeader(pName, HTTPUtil.formatHTTPDate(pValue));
|
||||
}
|
||||
|
||||
public void setHeader(String pName, String pValue) {
|
||||
|
@@ -32,7 +32,7 @@ import com.twelvemonkeys.io.FileUtil;
|
||||
import com.twelvemonkeys.lang.StringUtil;
|
||||
import com.twelvemonkeys.lang.Validate;
|
||||
import com.twelvemonkeys.net.MIMEUtil;
|
||||
import com.twelvemonkeys.net.NetUtil;
|
||||
import com.twelvemonkeys.net.HTTPUtil;
|
||||
import com.twelvemonkeys.util.LRUHashMap;
|
||||
import com.twelvemonkeys.util.NullMap;
|
||||
|
||||
@@ -972,7 +972,7 @@ public class HTTPCache {
|
||||
File cached = getCachedFile(pCacheURI, pRequest);
|
||||
if (cached != null && cached.exists()) {
|
||||
lastModified = cached.lastModified();
|
||||
//// System.out.println(" ## HTTPCache ## Last-Modified is " + NetUtil.formatHTTPDate(lastModified) + ", using cachedFile.lastModified()");
|
||||
//// System.out.println(" ## HTTPCache ## Last-Modified is " + HTTPUtil.formatHTTPDate(lastModified) + ", using cachedFile.lastModified()");
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -981,11 +981,11 @@ public class HTTPCache {
|
||||
int maxAge = getIntHeader(response, HEADER_CACHE_CONTROL, "max-age");
|
||||
if (maxAge == -1) {
|
||||
expires = lastModified + defaultExpiryTime;
|
||||
//// System.out.println(" ## HTTPCache ## Expires is " + NetUtil.formatHTTPDate(expires) + ", using lastModified + defaultExpiry");
|
||||
//// System.out.println(" ## HTTPCache ## Expires is " + HTTPUtil.formatHTTPDate(expires) + ", using lastModified + defaultExpiry");
|
||||
}
|
||||
else {
|
||||
expires = lastModified + (maxAge * 1000L); // max-age is seconds
|
||||
//// System.out.println(" ## HTTPCache ## Expires is " + NetUtil.formatHTTPDate(expires) + ", using lastModified + maxAge");
|
||||
//// System.out.println(" ## HTTPCache ## Expires is " + HTTPUtil.formatHTTPDate(expires) + ", using lastModified + maxAge");
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -997,7 +997,7 @@ public class HTTPCache {
|
||||
// Expired?
|
||||
if (expires < now) {
|
||||
// System.out.println(" ## HTTPCache ## Content is stale (content expired: "
|
||||
// + NetUtil.formatHTTPDate(expires) + " before " + NetUtil.formatHTTPDate(now) + ").");
|
||||
// + HTTPUtil.formatHTTPDate(expires) + " before " + HTTPUtil.formatHTTPDate(now) + ").");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1008,7 +1008,7 @@ public class HTTPCache {
|
||||
File cached = getCachedFile(pCacheURI, pRequest);
|
||||
if (cached != null && cached.exists()) {
|
||||
lastModified = cached.lastModified();
|
||||
//// System.out.println(" ## HTTPCache ## Last-Modified is " + NetUtil.formatHTTPDate(lastModified) + ", using cachedFile.lastModified()");
|
||||
//// System.out.println(" ## HTTPCache ## Last-Modified is " + HTTPUtil.formatHTTPDate(lastModified) + ", using cachedFile.lastModified()");
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1018,7 +1018,7 @@ public class HTTPCache {
|
||||
//noinspection RedundantIfStatement
|
||||
if (real != null && real.exists() && real.lastModified() > lastModified) {
|
||||
// System.out.println(" ## HTTPCache ## Content is stale (new content"
|
||||
// + NetUtil.formatHTTPDate(lastModified) + " before " + NetUtil.formatHTTPDate(real.lastModified()) + ").");
|
||||
// + HTTPUtil.formatHTTPDate(lastModified) + " before " + HTTPUtil.formatHTTPDate(real.lastModified()) + ").");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1082,7 +1082,7 @@ public class HTTPCache {
|
||||
static long getDateHeader(final String pHeaderValue) {
|
||||
long date = -1L;
|
||||
if (pHeaderValue != null) {
|
||||
date = NetUtil.parseHTTPDate(pHeaderValue);
|
||||
date = HTTPUtil.parseHTTPDate(pHeaderValue);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@
|
||||
package com.twelvemonkeys.servlet.cache;
|
||||
|
||||
import com.twelvemonkeys.io.FastByteArrayOutputStream;
|
||||
import com.twelvemonkeys.net.NetUtil;
|
||||
import com.twelvemonkeys.net.HTTPUtil;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -53,7 +53,7 @@ class WritableCachedResponseImpl implements WritableCachedResponse {
|
||||
protected WritableCachedResponseImpl() {
|
||||
cachedResponse = new CachedResponseImpl();
|
||||
// Hmmm..
|
||||
setHeader(HTTPCache.HEADER_CACHED_TIME, NetUtil.formatHTTPDate(System.currentTimeMillis()));
|
||||
setHeader(HTTPCache.HEADER_CACHED_TIME, HTTPUtil.formatHTTPDate(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public CachedResponse getCachedResponse() {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.twelvemonkeys.servlet.cache;
|
||||
|
||||
import com.twelvemonkeys.net.NetUtil;
|
||||
import com.twelvemonkeys.net.HTTPUtil;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -644,7 +644,7 @@ public class HTTPCacheTestCase {
|
||||
CacheResponse res = (CacheResponse) invocation.getArguments()[1];
|
||||
|
||||
res.setStatus(HttpServletResponse.SC_OK);
|
||||
res.setHeader("Date", NetUtil.formatHTTPDate(System.currentTimeMillis()));
|
||||
res.setHeader("Date", HTTPUtil.formatHTTPDate(System.currentTimeMillis()));
|
||||
res.setHeader("Cache-Control", "public");
|
||||
res.addHeader("X-Custom", "FOO");
|
||||
res.addHeader("X-Custom", "BAR");
|
||||
@@ -1126,7 +1126,7 @@ public class HTTPCacheTestCase {
|
||||
CacheResponse res = (CacheResponse) invocation.getArguments()[1];
|
||||
|
||||
res.setStatus(status);
|
||||
res.setHeader("Date", NetUtil.formatHTTPDate(System.currentTimeMillis()));
|
||||
res.setHeader("Date", HTTPUtil.formatHTTPDate(System.currentTimeMillis()));
|
||||
|
||||
for (Map.Entry<String, List<String>> header : headers.entrySet()) {
|
||||
for (String value : header.getValue()) {
|
||||
|
Reference in New Issue
Block a user