guoHuanMessi opened a new issue #2254:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2254
public static HttpServletRequest getServletRequest() {
ServletRequestAttributes requestAttributes =
(ServletRequestAttributes)RequestContextHolder.currentRequestAttributes();
return requestAttributes.getRequest();
}
public static RequestAttributes currentRequestAttributes() throws
IllegalStateException {
RequestAttributes attributes = getRequestAttributes();
if (attributes == null) {
if (jsfPresent) {
attributes =
FacesRequestAttributesFactory.getFacesRequestAttributes();
}
if (attributes == null) {
throw new IllegalStateException("No
thread-bound request found: " +
"Are you referring to request
attributes outside of an actual web request, " +
"or processing a request
outside of the originally receiving thread? " +
"If you are actually operating
within a web request and still receive this message, " +
"your code is probably running
outside of DispatcherServlet: " +
"In this case, use
RequestContextListener or RequestContextFilter to expose the current request.");
}
}
return attributes;
}
attributes 为空 ,因为cse定义了自己的上下文,对于这种依赖spring上下文如何处理。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]