@Test public void getClientIpWithoutUseProxies() { configurationService.setProperty("useProxies", false); configurationService.setProperty("proxies.trusted.ipranges", ""); clientInfoService = new ClientInfoServiceImpl(configurationService); String remoteIp = "127.0.0.1"; String xForwardedFor = "10.24.64.14"; assertEquals("127.0.0.1", clientInfoService.getClientIp(remoteIp, xForwardedFor)); assertEquals("127.0.0.1", clientInfoService.getClientIp(remoteIp, null)); assertEquals("127.0.0.1", clientInfoService.getClientIp(remoteIp, "")); }
@Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } @Autowired(required = true)  ClientInfoServiceImpl(ConfigurationService configurationService); }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } @Autowired(required = true)  ClientInfoServiceImpl(ConfigurationService configurationService); @Override String getClientIp(HttpServletRequest request); @Override String getClientIp(String remoteIp, String xForwardedForHeaderValue); @Override boolean isUseProxiesEnabled(); }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } @Autowired(required = true)  ClientInfoServiceImpl(ConfigurationService configurationService); @Override String getClientIp(HttpServletRequest request); @Override String getClientIp(String remoteIp, String xForwardedForHeaderValue); @Override boolean isUseProxiesEnabled();  }