在EJB3写的WebService中获取HttpServletRequest对象
HttpServletRequest request =
(HttpServletRequest)PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
这样就可以取得访问这个WebService方法的Request了。(我是用来取对方IP)
本文介绍了一种在EJB3编写的WebService中获取HttpServletRequest的方法。通过使用PolicyContext.getContext方法,可以取得当前请求的详细信息,例如客户端的IP地址等。
在EJB3写的WebService中获取HttpServletRequest对象
HttpServletRequest request =
(HttpServletRequest)PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
这样就可以取得访问这个WebService方法的Request了。(我是用来取对方IP)
320

被折叠的 条评论
为什么被折叠?