HADOOP-6607. Add different variants of non caching HTTP headers. (tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1409923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
210941550a
commit
5ce643babe
|
@ -145,6 +145,8 @@ Release 2.0.3-alpha - Unreleased
|
|||
|
||||
HADOOP-8999. SASL negotiation is flawed (daryn)
|
||||
|
||||
HADOOP-6607. Add different variants of non caching HTTP headers. (tucu)
|
||||
|
||||
Release 2.0.2-alpha - 2012-09-07
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -24,7 +24,12 @@ import java.net.BindException;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.net.URL;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.net.ssl.SSLServerSocketFactory;
|
||||
import javax.servlet.Filter;
|
||||
|
|
|
@ -38,6 +38,10 @@ public class NoCacheFilter implements Filter {
|
|||
throws IOException, ServletException {
|
||||
HttpServletResponse httpRes = (HttpServletResponse) res;
|
||||
httpRes.setHeader("Cache-Control", "no-cache");
|
||||
long now = System.currentTimeMillis();
|
||||
httpRes.addDateHeader("Expires", now);
|
||||
httpRes.addDateHeader("Date", now);
|
||||
httpRes.addHeader("Pragma", "no-cache");
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
|
||||
|
|
|
@ -546,6 +546,10 @@ public class TestHttpServer extends HttpServerFunctionalTest {
|
|||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
|
||||
assertEquals("no-cache", conn.getHeaderField("Cache-Control"));
|
||||
assertEquals("no-cache", conn.getHeaderField("Pragma"));
|
||||
assertNotNull(conn.getHeaderField("Expires"));
|
||||
assertNotNull(conn.getHeaderField("Date"));
|
||||
assertEquals(conn.getHeaderField("Expires"), conn.getHeaderField("Date"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue