The
looks like this:
String Agent = Request.getheader ("user-agent");
SYSTEM.OUT.PRINTLN (agent);
StringTokenizer st = new StringTokenizer (agent, ";");
St.nexttoken ();
String Userbrowser = St.nexttoken ();
System.out.println (Userbrowser);
String Useros = St.nexttoken ();
System.out.println (Useros); System.out.println (System.getproperty ("Os.name"));
Win2003 unexpectedly is Win XP?
System.out.println (System.getproperty ("os.version"));
System.out.println (System.getproperty ("Os.arch")); System.out.println (Request.getheader ("user-agent")); Returns the version number, type System.out.println (Request.getmethod ()) of the client browser; : The method of obtaining the data from the client to the server has the type System.out.println (Request.getrequesturi ()) of Get, post, put etc. : Gets the client address System.out.println (Request.getservletpath ()) that sent the request string; : Gets the file path System.out.println (Request.getservername ()) of the script file requested by the client; : Get the name of the server System.out.println (Request.getserverport ()); : Get the server's port number System.out.println (REQUEST.GETREMOTEADDR ()); : Obtain the client's IP address System.out.println (Request.getremotehost ()); : Get the name of the client computer, if it fails, return the IP address of the client computer
System.out.println (Request.getprotocol ()); : System.out.println (Request.getheadernames ());
: Returns the name of all request headers, and the result set is an instance of a enumeration (enumerated) class System.out.println ("Protocol:" + request.getprotocol ());
System.out.println ("Scheme:" + request.getscheme ());
System.out.println ("Server Name:" + request.getservername ());
System.out.println ("Server Port:" + request.getserverport ());
System.out.println ("Protocol:" + request.getprotocol ());
System.out.println ("Server Info:" + getservletconfig (). Getservletcontext (). Getserverinfo ());
System.out.println ("Remote Addr:" + request.getremoteaddr ());
System.out.println ("Remote Host:" + request.getremotehost ());
System.out.println ("Character Encoding:" + request.getcharacterencoding ());
System.out.println ("Content Length:" + request.getcontentlength ());
System.out.println ("Content Type:" + request.getcontenttype ());
System.out.println ("Auth Type:" + request.getauthtype ()); System.out.println ("HTTP method:" + Request.getmethod ());
System.out.println ("Path Info:" + request.getpathinfo ());
System.out.println ("Path Trans:" + request.getpathtranslated ());
System.out.println ("Query String:" + request.getquerystring ());
System.out.println ("Remote User:" + request.getremoteuser ());
System.out.println ("Session Id:" + Request.getrequestedsessionid ());
System.out.println ("Request URI:" + Request.getrequesturi ());
System.out.println ("Servlet Path:" + Request.getservletpath ());
System.out.println ("Accept:" + request.getheader ("Accept"));
System.out.println ("Host:" + Request.getheader ("host"));
System.out.println ("Referer:" + request.getheader ("Referer"));
System.out.println ("Accept-language:" + request.getheader ("Accept-language"));
System.out.println ("accept-encoding:" + request.getheader ("accept-encoding"));
System.out.println ("user-agent:" + request.getheader ("user-agent"));
System.out.println ("Connection:" + request.getheader ("Connection")); System.out.println ("Cookie:" + request.)GetHeader ("Cookie"));
Get the value of User-agent
Use request.header["User-agent" in asp.net to get the user Agent of the browser, or use request.useragent to obtain it;
Java in the use of Request.getheader ("User-agent") to obtain;
The corresponding use in PHP: $_server[http_user_agent];
JS in the use of navigator.useragent to obtain (the client often use it to do browser-compatible).
The above is small series for everyone to bring Java access to customer service information method (System, browser, etc.) of the entire content, hope to help you, a lot of support cloud Habitat Community ~