📄 e1045. getting the client's address in a servlet.txt
字号:
// See also e1035 The Quintessential Servlet
// This method is called by the servlet container to process a GET request.
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
// Get client's IP address
String addr = req.getRemoteAddr(); // 123.123.123.123
// Get client's hostname
String host = req.getRemoteHost(); // hostname.com
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -