Request. get... getHeader information parameter, setrequestheader Parameter

Source: Internet
Author: User

Request. get... getHeader information parameter, setrequestheader Parameter
ReprintedBytes 

StringTokenizer st = new StringTokenizer (agent ,";");
St. nextToken ();
// Obtain the user's browser name
String userbrowser = st. nextToken ();
System. out. println (userbrowser );
// Obtain the user's OS name
String useros = st. nextToken ();
System. out. println (useros );
// Obtain the information of the local machine as follows:
// Operating system information
System. out. println (System. getProperty ("OS. name"); // win2003 turns out to be winxp?
System. out. println (System. getProperty ("OS. version "));
System. out. println (System. getProperty ("OS. arch "));
// Browser:
System. out. println (request. getHeader ("user-agent "));
// Send another red packet
System. out. println (request. getHeader ("user-agent"); // return the version and type of the client browser.
System. out. println (request. getMethod (); // The methods used to obtain data transmitted from the client to the server include get, post, and put.
System. out. println (request. getRequestURI (); // obtain the client address that sends the request string
System. out. println (request. getServletPath (); // obtain the file path of the script file requested by the client
System. out. println (request. getServerName (); //: Obtain the server name.
System. out. println (request. getServerPort (); //: Obtain the server port number.
System. out. println (request. getRemoteAddr (); //: Obtain the Client IP address.
System. out. println (request. getRemoteHost (); //: Obtain the name of the client computer. If the name fails, the IP address of the client computer is returned.
System. out. println (request. getProtocol ());//:
System. out. println (request. getHeaderNames (); //: returns the names of all requestheaders. The result set is an instance of the enumeration (enumeration) 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 ());

Related Article

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.