As Samet noted, the ApplicationRootURL that you can read using the Core API only displays the value of the modeler setting.
However, the technique you're trying is impossible to achieve. The whole concept of hosts and webservers is to obfuscate this information. Your frontfacing webserver accepts requests for certain resources. It can then modify or forward these requests in any way it chooses. Once the request hits the Mendix Appcontainer, all of this information is stripped and only the information that should be useful to the appcontainer is retained. This is the request path and any parameters that may have been passed.
This is the same for J2EE application servers, so don't worry, this isn't some weird quirky Mendix thing :)
A workaround could be the one you proposed in one of the comments: let the client pass the URL that it's accessing in a cookie or parameter.
The java actions only retrieves the application root url in your project settings. So if you set this setting right, you can retrieve it later with the java action.