728x90
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package egovframework.com.cmm.util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
public class EgovHttpRequestHelper {
public static boolean isInHttpRequest() {
try {
getCurrentRequest();
} catch (IllegalStateException ise) {
return false;
}
return true;
}
public static HttpServletRequest getCurrentRequest() {
ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
return sra.getRequest();
}
public static String getRequestIp() {
return getCurrentRequest().getRemoteAddr();
}
public static String getRequestURI() {
return getCurrentRequest().getRequestURI();
}
public static HttpSession getCurrentSession() {
return getCurrentRequest().getSession();
}
}
|
cs |
@
호출
1
|
HttpServletRequest request = EgovHttpRequestHelper.getCurrentRequest();
|
cs |
@
728x90
반응형