标签:style blog http color io os java sp div
package com.handpay.decision.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; /** * Copyright (C),HANDPAY<br> * * 日志记录 * * @author muzhongjiang * @date 2014年10月21日 */ public class LogRecordInterceptor implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.err.println("【 在业务处理器处理请求之前被调用 】"); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { System.err.println("【在业务处理器处理请求执行完成后,生成视图之前执行的动作】"); } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { System.err.println("【DispatcherServlet完全处理完请求后被调用】"); } }
<!-- 拦截器: --> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**/*.json" /> <bean id="cacheInterceptor" class="com.handpay.decision.interceptor.LogRecordInterceptor" /> </mvc:interceptor> </mvc:interceptors>
标签:style blog http color io os java sp div
原文地址:http://www.cnblogs.com/muzhongjiang/p/4040780.html