package com.palacesun.masking.appuser;

import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

public class ServletAppUserInterceptor implements HandlerInterceptor {
   public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException, IOException {
      System.out.println("----- EncInterceptor.preHandle -----");
      ServletAppUserFilter servletAppUserFilter = new ServletAppUserFilter();
      FilterChain chain = new FilterChain() {
         public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) {
         }
      };
      servletAppUserFilter.init((FilterConfig)null);
      servletAppUserFilter.doFilter(request, response, chain);
      return servletAppUserFilter.doFilterResultFlag;
   }

   public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
   }

   public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
   }
}
