You can get the name of the server via localhost like this:
String hostname = InetAddress.getLocalHost().getHostName();
Update
The above returns the name of the server it runs in, so it would give the name of the webservice host.
If you need the name of the server in front of the webservice, you can get that from the request:
String hostname = request.getRemoteHost();
should do the trick. Beware that the remote hostname is what the socket client used to set up the connection, this need not be the DNS name. If you need the DNS name, you can use:
String hostname = InetAddress.getByName(request.getRemoteAddr()).getHostName();
Update 2
If what you mean is not related to the server (solution 1) or a forwarding proxy (solution 2) but a kind of logical cluster name, you could define that in your web.xml as context parameter:
<context-param>
<param-name>clustername</param-name>
<param-value>OurPrettyCluster</param-value>
</context-param>
and read that in your servlet:
ServletContext context = getServletContext();
String clustername = context.getInitParameter("clustername");
If this is also not helping, you need to update your question and describe your cluster configuration because with the information given not much more can be done.