string agent = request.getheader("user-agent");
stringtokenizer st = new stringtokenizer(agent,";");
st.nexttoken();
//Get the user's browser name
string userbrowser = st.nexttoken();
//Get the user's operating system name
string users = st.nexttoken();
You can also get local machine information like this:
operating system information
system.getproperty("os.name"); //win2003 is actually win xp?
system.getproperty("os.version");
system.getproperty("os.arch");
Browser:
request.getheader("user-agent")
sends another red envelope
request.getheader("user-agent") returns the version number and type of the client browser
getheader(string name): obtains the transmission file header information defined by the http protocol,
request.getmethod(): obtains the data transmitted from the client to the server The methods include get, post, put and other types of
requests. getrequesturi(): Get the client address that issued the request string
request. getservletpath(): Get the file path of the script file requested by the client
request. getservername(): Get the server
request.getserverport(): Get the server's port number
request.getremoteaddr
(): Get the client's IP address
request.getremotehost(): Get the name of the client computer. If it fails, return the client computer's IP address
request. getprotocol():
request.getheadernames(): Returns the names of all request headers. The result set is an instance of the enumeration class
request.getheaders(string name): Returns all the values of the request header with the specified name. The result set is An instance of an enumeration class