不墨迹,直接上代码”
Java Web 中通过HttpServletRequest 获取请求头信息以及客户端真实IP
Controller
package com.example.controller;
import com.example.service.RetIpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @ClassName RequestIpController
* @Description TODO
* @Date 2021/11/12 上午11:56
*/
@RestController
@RequestMapping(value = "/reslut/ip")
@Api(value = "用户请求信息" , description = "用户请求信息")
public class RetIpController {
@Au