How To get clients computer name?

So pretty simple problem. I’ve looked through documentation about httpsession, webapplicationcontext, etc. it seems i can get pretty much anything (like browser version) but i cant get name of the clients computer, accessing my application.

Anyone dealt with this kind of problem before?


Well, it depends on what you mean by the “name of the client’s computer”. If you mean the IP or the hostmask, then those you can get from the HttpServletRequest class and an instance of that you can get in your application’s transactionStart-method.

public void transactionStart(Application application, Object transactionData) {
   if (transactionData instanceof HttpServletRequest) {
      HttpServletRequest httpServletRequest = (HttpServletRequest) transactionData;
      String ip = httpServletRequest.getRemoteAddr();
      String host = httpServletRequest.getRemoteHost();

On the other hand, if you mean the user’s actual computer name, like internal Windows computer name, then that is information that you won’t be able to access (at least not in a useful manner).

If your users log in to Microsoft domain with domain controllers you can query Active Directory for pretty much everything based on users ip. You can get subnet info, full domain info, netbios name and even logged in users in that ip.