Spring mvc aop to get request and response
时间:2021-12-14 作者:匿名
@Aspect public class LoggingAspect { @Before("execution(* xxxxxxxxxxx(..))") public void logBefore(JoinPoint joinPoint) { / /此处可以通过以下方法得到REQUEST,另外也可以通过参数方法得 HttpServletRequest request = ((ServletRequestAttributes) 域名equestAttributes()).getRequest(); 域名tln("******"+域名arameter("username")); 域名tln("******"); 域名tln("******"); 域名tln("******"); 域名tln("logBefore() is running!"); 域名tln("hijacked : " + 域名ignature().getName()); 域名tln("******"); //Currently, I just use this method to get repines, another way is to use filter to set request and response, then use them in AOP method HttpServletResponse response = (HttpServletResponse) 域名rgs()[0]; } }