1
This commit is contained in:
parent
90b805d0f4
commit
8f9e5cf565
@ -67,6 +67,7 @@ public class SpringUtil implements ApplicationContextAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static HttpServletRequest getRequest() {
|
public static HttpServletRequest getRequest() {
|
||||||
|
try {
|
||||||
RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
|
RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
|
||||||
if(null == requestAttributes) {
|
if(null == requestAttributes) {
|
||||||
log.warn("The 'RequestAttributes' object is null, so can`t get 'HttpServletRequest' object!");
|
log.warn("The 'RequestAttributes' object is null, so can`t get 'HttpServletRequest' object!");
|
||||||
@ -77,6 +78,10 @@ public class SpringUtil implements ApplicationContextAware {
|
|||||||
HttpServletRequest request = servletRequestAttributes.getRequest();
|
HttpServletRequest request = servletRequestAttributes.getRequest();
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
log.error("The request is error:{}",e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HttpServletResponse getResponse() {
|
public static HttpServletResponse getResponse() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user