GET request line method_servlet, GET request _ servlet

Source: Internet
Author: User

GET request line method_servlet, GET request _ servlet



1 // 1. encapsulated as a template: GET request line method _ servlet [hoquqkqqhhfhfa_servlet] 2 3 // GET request line 4 5 // GET request method 6 String method = request. getMethod (); 7 System. out. println (method); 8 9 // obtain the request resource address 10 String requestURI = request. getRequestURI (); 11 System. out. println (requestURI); 12 StringBuffer requestURL = request. getRequestURL (); 13 System. out. println (requestURL. toString (); 14 15 // obtain the client address 16 String remoteAddr = request. getRemoteAddr (); 17 System. out. println (remoteAddr); 18 19 // obtain the web application name (emphasis) 20 String contextPath = request. getContextPath (); 21 System. out. println (contextPath); 22 23 // obtain the get parameter String 24 String queryString = request. getQueryString (); 25 System. out. println (queryString );

Entertainment

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.