getting client IP in java (behind firewall)
We have on application in JAVA where we have used shell scripts for handling dot matrix printing part. These shell scripts are kept at OS level and if we are accessing the application over thin client then, these shell script directory need to be mounted on Thin client for running the script. This works fine in LAN. In LAN thin client IP is fix and ssh between server and thin clent is enabled. When I access this application using broad band, linux PC over VPN tunnel mode connection through Fortigate firewall, F/W assigns one virtual IP to the client. We can do ssh and mounting with server. But when in application we taken IP address for accessing script we are getting Firewall IP. (not the one F/W has assigned to client) so printing is not working. Can You suggest how can I capture this IP in application we have tried using following command.
String hostname=getCurrentRequest().getRemoteHost(); String useragent=getCurrentRequest().getHeader("user-agent"); // Mahesh String hostaddcur=getCurrentRequest().getRemoteAddr(); /* String ip = ""; InetAddress inetAddress = InetAddress.getLocalHost(); ip = inetAddress.getHostAddress(); log.info("Server Host Name :: " + inetAddress.getHostName()); log.info("Server IP Address :: " + ip); */