How do you create a REST client for Java? [closed]

This is an old question (2008) so there are many more options now than there were then: Apache CXF has three different REST Client options Jersey (mentioned above). Spring RestTemplate superceded by Spring WebClient Commons HTTP Client build your own for older Java projects. UPDATES (projects still active in 2020): Apache HTTP Components (4.2) Fluent … Read more

How do I get the remote address of a client in servlet?

try this: public static String getClientIpAddr(HttpServletRequest request) { String ip = request.getHeader(“X-Forwarded-For”); if (ip == null || ip.length() == 0 || “unknown”.equalsIgnoreCase(ip)) { ip = request.getHeader(“Proxy-Client-IP”); } if (ip == null || ip.length() == 0 || “unknown”.equalsIgnoreCase(ip)) { ip = request.getHeader(“WL-Proxy-Client-IP”); } if (ip == null || ip.length() == 0 || “unknown”.equalsIgnoreCase(ip)) { ip = … Read more