1/*2 * Copyright 2014 The Apache Software Foundation.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package org.apache.juddi.webconsole;
1718import java.io.IOException;
19import javax.servlet.Filter;
20import javax.servlet.FilterChain;
21import javax.servlet.FilterConfig;
22import javax.servlet.ServletException;
23import javax.servlet.ServletRequest;
24import javax.servlet.ServletResponse;
25import javax.servlet.http.HttpServletResponse;
2627/**28 *29 * @author Alex O'Ree30 */31publicclassNoCacheFilterimplements Filter {
3233 @Override
34publicvoid init(FilterConfig fc) throws ServletException {
3536 }
3738 @Override
39publicvoid doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
40 HttpServletResponse hsr = (HttpServletResponse) res;
41 hsr.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.42 hsr.setHeader("Pragma", "no-cache"); // HTTP 1.0.43 hsr.setDateHeader("Expires", 0); // Proxies.44 chain.doFilter(req, res);
45 }
4647 @Override
48publicvoid destroy() {
4950 }
5152 }