Edit Edit

Java Servlet FAQ


How do you get information about the server?


There are four functions that can be used to get more information about the server in which the servlet is running. Two of them are in the ServletRequest class:

Method
Description
public String getServerName()gets the name of the server in which the servlet is running
public int getServerPort()gets the port number of the server in which the servlet is running

The other two functions are defined in the ServletContext class:

Method
Description
public String getServerInfo()gets the server name and version
public Object getAttribute()gets a server-dependent attribute




Last updated 12/26/1999 05:34:42 PM