package com.xy.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.t59.model.dto.Userinfo;
public class CodeFilter extends HttpServlet implements Filter {
private FilterConfig filterConfig;
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) {
try {
((HttpServletResponse) response).setHeader("Cache-Control",
"no-cache");
((HttpServletResponse) response).setHeader("Pragma", "no-cache");
((HttpServletResponse) response).setDateHeader("Expires", -1);
request.setCharacterEncoding("gb2312");
response.setCharacterEncoding("gb2312");
filterChain.doFilter(request, response);
} catch (ServletException sx) {
filterConfig.getServletContext().log(sx.getMessage());
} catch (IOException iox) {
filterConfig.getServletContext().log(iox.getMessage());
}
}
public void destroy() {
}
}