| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.show.FloatServerResponse; |
| | | import com.lf.server.entity.show.ReqParamFloatServer; |
| | | import com.lf.server.entity.other.FloatServerResponse; |
| | | import com.lf.server.entity.other.ReqParamFloatServer; |
| | | import com.lf.server.helper.HttpHelper; |
| | | import com.lf.server.helper.LicHelper; |
| | | import io.swagger.annotations.Api; |
| | |
| | | LicHelper helper = getHelper(); |
| | | String reqJson = helper.b(str); |
| | | |
| | | ReqParamFloatServer reqParam = JSON.parseObject(reqJson, ReqParamFloatServer.class); |
| | | FloatServerResponse fsr = new FloatServerResponse(reqParam); |
| | | ReqParamFloatServer rfs = JSON.parseObject(reqJson, ReqParamFloatServer.class); |
| | | FloatServerResponse fsr = new FloatServerResponse(rfs); |
| | | |
| | | String resJson = JSON.toJSONString(fsr); |
| | | String strRes = helper.a(resJson); |
| | | |
| | | res.getWriter().write(strRes); |
| | | } catch (Exception ex) { |
| | | // |
| | | String str = ex.getMessage(); |
| | | } |
| | | } |
| | | |
| | |
| | | return licHelper; |
| | | } |
| | | |
| | | @SuppressWarnings("AlibabaUndefineMagicConstant") |
| | | private static String getClientIpAddr(HttpServletRequest req) { |
| | | String ip; |
| | | if ((ip = req.getHeader("x-forwarded-for")) == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = req.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = req.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = req.getRemoteAddr(); |
| | | } |
| | | |
| | | return ip; |
| | | } |
| | | |
| | | public static void test() { |
| | | try { |
| | | ReqParamFloatServer reqParam = new ReqParamFloatServer("192.168.20.106", "12316"); |