【发布时间】:2014-05-17 15:01:33
【问题描述】:
我正在开发 Spring MVC 控制器项目,在该项目中我正在从浏览器进行 GET URL 调用 -
下面是我从浏览器发出 GET 调用的 url -
http://127.0.0.1:8080/testweb/processing?workflow=test&conf=20140324&dc=all
下面是点击浏览器后调用的代码 -
@RequestMapping(value = "processing", method = RequestMethod.GET)
public @ResponseBody ProcessResponse processData(@RequestParam("workflow") final String workflow,
@RequestParam("conf") final String value, @RequestParam("dc") final String dc) {
System.out.println(workflow);
System.out.println(value);
System.out.println(dc);
// some other code
}
问题陈述:-
现在有什么方法可以从某个标头中提取 IP 地址吗?这意味着我想知道来自哪个 IP 地址的呼叫,这意味着无论是谁在 URL 上方呼叫,我都需要知道他们的 IP 地址。这可以吗?
【问题讨论】:
-
尝试使用 Spring AOP 并处理 HttpServletRequest。 stackoverflow.com/questions/19271807/…
标签: java spring-mvc ip-address