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.