String agent = request. getheader ("user-agent ");
Stringtokenizer st = new stringtokenizer (agent ,";");
St. nexttoken ();
// Obtain the user's browser name
String userbrowser = st. nexttoken ();
// Obtain the user's OS name
String useros = st. nexttoken ();
You can also obtain the information of the local machine as follows:
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 ")
Send another red packet
Request. getheader ("user-agent") returns the version and type of the client browser.
Getheader (string name): Get the header information defined by the http protocol,
Request. getmethod (): The methods used to obtain data transmitted from the client to the server include get, post, put, and so on.
Request. getrequesturi (): obtains the client address of the request string.
Request. getservletpath (): Obtain the path of the script file requested by the client.
Request. getservername (): Get the server name
Request. getserverport (): Get the server port number
Request. getremoteaddr (): Obtain the Client IP Address
Request. getremotehost (): obtains the name of the client computer. If the name fails, the IP address of the client computer is returned.
Request. getprotocol ():
Request. getheadernames (): returns the names of all request headers. The result set is an instance of the enumeration (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 the enumeration (enumeration) class.