Hi Folks,
One of our JSP programmers came up with the following for me. We put it in
the tomcat_home/webapps/ROOT directory and ask our customers to run it if
they are experiencing problems. That way, we can know which of our MT
Tomcat servers they are connected to.
I don't claim to understand how it works, but it does.
Hope this is helpful.
Larry
<%@ page import="java.util.*,java.io.*" %>
<%
String cmd = "hostname";
String outstr = "";
try {
Runtime rt = Runtime.getRuntime();
Process p = rt.exec(cmd);
try {
InputStreamReader ise = new InputStreamReader(p.getErrorStream());
BufferedReader bre = new BufferedReader(ise);
InputStreamReader iso = new InputStreamReader(p.getInputStream());
BufferedReader bro = new BufferedReader(iso);
String line=null;
while ( (line = bre.readLine()) != null ) {
outstr += line;
}
while ( (line = bro.readLine()) != null ) {
outstr += line;
}
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
int exitVal = p.waitFor();
}
catch (Throwable t) {
t.printStackTrace();
}
%>
<br>
Hostname: <strong><%=outstr%></strong><br>
Your IP:
<strong><%=request.getRemoteAddr()%></strong><br>
Service IP:
<strong><%=request.getLocalAddr()%></strong><br>
On Mon, Nov 4, 2013 at 11:26 AM, Patrick Snyder <[email protected]
> wrote:
> We are running six Mid Tier servers and I would like to display the name
> of the current server that the user is pointed at on the login page. Is
> there a JSP call that I can make or a cookie value that exists to return
> the server name? I understand that request.getServerName() will return a
> "server name" but that call represents the host domain name which is not
> what I need. I need to know the mid tier name or server name or server
> number so we can tell which one of our six servers the user is on at a
> glance. Thank you.
>
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> "Where the Answers Are, and have been for 20 years"
>
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
"Where the Answers Are, and have been for 20 years"