f29b147cb87084e191dcea1d2184727e11bfdfeb.svn-base 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. *
  3. */
  4. package com.yihu.base.filters;
  5. import java.io.IOException;
  6. import java.text.SimpleDateFormat;
  7. import java.util.Date;
  8. import java.util.Timer;
  9. import javax.servlet.Filter;
  10. import javax.servlet.FilterChain;
  11. import javax.servlet.FilterConfig;
  12. import javax.servlet.ServletException;
  13. import javax.servlet.ServletRequest;
  14. import javax.servlet.ServletResponse;
  15. import javax.servlet.http.HttpServletRequest;
  16. import com.coreframework.db.DB;
  17. import com.coreframework.db.Sql;
  18. import com.coreframework.util.AppConfig;
  19. import com.yihu.base.ConfigUtil;
  20. import com.yihu.jkedu.enums.MyDatabaseEnum;
  21. import com.yihu.main.ServerConsole;
  22. import com.yihu.utils.SecretUtil;
  23. /**
  24. * @author zhangzz
  25. * @company yihu.com 2014-12-25上午9:40:29
  26. */
  27. public class SysBaseFilter implements Filter {
  28. protected FilterConfig filterConfig;
  29. protected String encoding;
  30. public void destroy() {
  31. }
  32. public void doFilter(ServletRequest request, ServletResponse response,
  33. FilterChain chain) throws IOException, ServletException {
  34. HttpServletRequest req = (HttpServletRequest) request;
  35. request.setCharacterEncoding(encoding);
  36. chain.doFilter(request, response);
  37. }
  38. public void init(FilterConfig filterConfig) throws ServletException {
  39. this.filterConfig = filterConfig;
  40. encoding = filterConfig.getInitParameter("encoding");
  41. ServerConsole.init();
  42. }
  43. }