aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/helper/ServletHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/helper/ServletHelper.java')
-rw-r--r--src/main/java/org/traccar/helper/ServletHelper.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/helper/ServletHelper.java b/src/main/java/org/traccar/helper/ServletHelper.java
index f951d17c0..e3481e249 100644
--- a/src/main/java/org/traccar/helper/ServletHelper.java
+++ b/src/main/java/org/traccar/helper/ServletHelper.java
@@ -5,24 +5,23 @@ import javax.servlet.http.HttpServletRequest;
public final class ServletHelper {
-
private ServletHelper() {
}
public static String retrieveRemoteAddress(HttpServletRequest request) {
if (request != null) {
- String ipAddress = request.getHeader("X-FORWARDED-FOR");
+ String remoteAddress = request.getHeader("X-FORWARDED-FOR");
- if (ipAddress != null && !ipAddress.isEmpty()) {
- return ipAddress.substring(0, ipAddress.indexOf(",")); //Removes the additional data
+ if (remoteAddress != null && !remoteAddress.isEmpty()) {
+ return remoteAddress.substring(0, remoteAddress.indexOf(",")); // removes the additional data
} else {
- ipAddress = request.getRemoteAddr();
- return ipAddress;
+ remoteAddress = request.getRemoteAddr();
+ return remoteAddress;
}
-
} else {
return null;
}
}
+
}