Spring获取HttpServletRequest对象
<!-- WEB.XML中配置相关的监听机制 -->
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
//在任意的class下通过以下方法获取到HttpServletRequest
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();