.net core RequestContextListener有什么用?

RequestContextListener有什么用?1. 通过注解获得它(非常简单,推荐):公共类Hello{@autowiredhttpservletrequest//youcan Get the

RequestContextListener有什么用?

1. 通过注解获得它(非常简单,推荐):公共类Hello{@autowiredhttpservletrequest//youcan Get the request here}

2网站.xml在以下位置配置侦听器:Java代码:HttpServletRequest request=((servletrequestattributes)RequestContextHolder.getRequestAttributes()).getRequest()

3。直接传入参数(此方法不易使用,不建议使用):public string hello(HttpServletRequest)

4。如果有struts:HttpServletRequest=ServletActionContext.getRequest请求()