| getMethod() | ใช้คืนค่า วิธีการร้องขอ ว่าเป็นแบบ GET หรือ POST |
|---|---|
| getQueryString() | ใช้คืนค่า ชื่อและข้อมูล ที่ส่งมาพร้อมกับการร้องขอ (เช่นข้อมูลหลัง Question Mark) |
| getContextPath() | ใช้คืนค่า Context Path ของ File ที่เรียกใช้คำสั่งนี้ (Context Path คือ Root ของ Folder) |
| getRequestURI() | ใช้คืนค่า URI ของ File ที่เรียกใช้คำสั่งนี้ (URI คือ Path ตั้งแต่ Root จนถึง File ที่เรียกใช้คำสั่งนี้) |
| getRequestURL() | ใช้คืนค่า URL ของ File ที่เรียกใช้คำสั่งนี้ (URL คือ ตั้งแต่ Http จนถึง File ที่เรียกใช้คำสั่งนี้) |
| getServletPath() | ใช้คืนค่า Path ของ URL ที่ Servlet ร้องขอ |
| getRequestedSessionId() | ใช้คืนค่า ID ของ Session ในขณะนั้น |
| getParameter() | ใช้คืนค่า ข้อมูล ที่ส่งมาพร้อมกับการร้องขอ (ชื่อตัวแปรที่ส่งมา เช่น ชื่อของช่องรับข้อมูล) |
| getParameterValues() | ใช้คืนค่า ข้อมูล ที่ส่งมาพร้อมกับการร้องขอ ใช้ในกรณีที่ ชื่อตัวแปรที่ส่งมา มีซ้ำกันมากกว่า 1 ตัว |
| getServerName() | ใช้คืนค่า ชื่อของ Server เช่น localhost |
| getServerPort() | ใช้คืนค่า Port ที่เรียกใช้งาน |
| getRemoteAddr() | ใช้คืนค่า IP Address |
| getProtocol() | ใช้คืนค่า ชื่อและเวอร์ชั่น ของ Protocol |
| getCookies() | ใช้คืนค่า Cookie ทั้งหมด |
method:getMethod ();
return type:String
special:static
content:ใช้คืนค่า วิธีการร้องขอ ว่าเป็นแบบ GET หรือ POST
example:String method = request.getMethod();
method:getQueryString ();
return type:String
special:static
content:ใช้คืนค่า ชื่อและข้อมูล ที่ส่งมาพร้อมกับการร้องขอ (เช่นข้อมูลหลัง Question Mark)
example:String query_string = request.getQueryString ();
method:getContextPath ();
return type:String
special:static
content:ใช้คืนค่า Context Path ของ File ที่เรียกใช้คำสั่งนี้ (Context Path คือ Root ของ Folder)
example:String context_path = request.getContextPath ();
method:getRequestURI ();
return type:String
special:static
content:ใช้คืนค่า URI ของ File ที่เรียกใช้คำสั่งนี้ (URI คือ Path ตั้งแต่ Root จนถึง File ที่เรียกใช้คำสั่งนี้)
example:String request_uri = request.getRequestURI ();
method:getRequestURL ();
return type:String
special:static
content:ใช้คืนค่า URL ของ File ที่เรียกใช้คำสั่งนี้ (URL คือ ตั้งแต่ Http จนถึง File ที่เรียกใช้คำสั่งนี้)
example:String request_url = request.getRequestURL ();
method:getServletPath ();
return type:String
special:static
content:ใช้คืนค่า Path ของ URL ที่ Servlet ร้องขอ
example:String servlet_path = request.getServletPath ();
method:getRequestedSessionId ();
return type:String
special:static
content:ใช้คืนค่า ID ของ Session ในขณะนั้น
example:String request_session_id = request.getRequestedSessionId ();
method:getParameter ( object_string_name );
return type:String
special:static
content:ใช้คืนค่า ข้อมูล ที่ส่งมาพร้อมกับการร้องขอ (ชื่อตัวแปรที่ส่งมา เช่น ชื่อของช่องรับข้อมูล)
example:String parameter = request.getParameter ( “username” );
method:getParameterValues ( object_string_name );
return type:String Array
special:static
content:ใช้คืนค่า ข้อมูล ที่ส่งมาพร้อมกับการร้องขอ ใช้ในกรณีที่ ชื่อตัวแปรที่ส่งมา มีซ้ำกันมากกว่า 1 ตัว
example:String [ ] parameter_values = request.getParameterValues ( “colors” );
method:getServerName ();
return type:String
special:static
content:ใช้คืนค่า ชื่อของ Server เช่น localhost
example:String server_name = request.getServerName ();
method:getServerPort ();
return type:String
special:static
content:ใช้คืนค่า Port ที่เรียกใช้งาน
example:String server_port = request.getServerPort ();
method:getRemoteAddr ();
return type:String
special:static
content:ใช้คืนค่า IP Address
example:String remote_addr = request.getRemoteAddr ();
method:getProtocol ();
return type:String
special:static
content:ใช้คืนค่า ชื่อและเวอร์ชั่น ของ Protocol
example:String protocol = request.getProtocol ();
method:getCookies ();
return type:Cookie Array
special:static
content:ใช้คืนค่า Cookie ทั้งหมด
example:Cookie [ ] cookies = request.getCookies (); String name = cookies[0].getName (); String value = cookies[0].getValue ();