Request.get. GetHeader information parameters that can be obtained

Source: Internet
Author: User

reproduced

StringTokenizer st = new StringTokenizer (agent, ";");
St.nexttoken ();
Get the user's browser name
String Userbrowser = St.nexttoken ();
System.out.println (Userbrowser);
Get the user's operating system name
String Useros =st.nexttoken ();
System.out.println (Useros);
This information can also be obtained from this machine:
Operating System Information
System.out.println (System.getproperty ("Os.name")); Win2003 unexpectedly is WinXP?
System.out.println (System.getproperty ("os.version"));
System.out.println (System.getproperty ("Os.arch"));
Browser:
System.out.println (Request.getheader ("user-agent"));
and send a red envelope.
System.out.println (Request.getheader ("user-agent"));//Returns the version number, type of the client browser
System.out.println (Request.getmethod ());//: Get, post, put, etc. for client to send data to server side
System.out.println (Request.getrequesturi ());//: Obtain the client address of the issuing request string
System.out.println (Request.getservletpath ());//: Get the file path of the script file requested by the client
System.out.println (Request.getservername ()); : Get the name of the server
System.out.println (Request.getserverport ()); : Gets the port number of the server
System.out.println (Request.getremoteaddr ()); : Obtain the IP address of the client
System.out.println (Request.getremotehost ());//: Gets the name of the client computer and, if it fails, returns the IP address of the client computer
System.out.println (Request.getprotocol ()); :
System.out.println (Request.getheadernames ()); : Returns the name of all Requestheader, the result set is an instance of a enumeration (enum) class

System.out.println ("Session Id:" +request.getrequestedsessionid ());
System.out.println ("Content Length:" +request.getcontentlength ());
System.out.println ("Remote User:" +request.getremoteuser ());
System.out.println ("Request URI:" +request.getrequesturi ());
System.out.println ("Host:" + Request.getheader ("host"));
System.out.println ("Connection:" +request.getheader ("Connection"));
System.out.println ("Cookie:" +request.getheader ("Cookie"));
System.out.println ("Created:" + session.getcreationtime ());

Request.get. GetHeader information parameters that can be obtained

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.