Q: Restlet find origin IP I would like to find out the origin IP address a request came from to my resource.
I have the next two methods to retrieve it.
String ipAddress = (Series) Request.getCurrent().getAttributes().
                    get("org.restlet.http.headers").getFirstValue("X-Forwarded-For");
String ip = ipAddress.split(" ")[0];

and 
List<String> ipsList = Request.getCurrent().getClientInfo().getForwardedAddresses();
String ip = ipsList.get(ipsList.size() - 1);

Two questions:


*

*Are they both correct (does it work)?

*Which is better (if they both work, which is better regarding efficiency/resources/runtime)?

