ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletResponse response = attrs.getResponse(); HttpServletRequest request = attrs.getRequest();