容易混淆的几个方法

现在觉得有些东西非常容易搞混淆现在把他记录下来:

request方法的
  getRequestURL:返回的是  
      http://localhost:8080/blueyanghualongSerlvet/login.jsp
            ()
  getRequestURI:
     返回的是/blueyanghualongSerlvet/login.jsp(资源名称)

  getContextPath:
      返回的是/blueyanghaulognServlet(web站点信息)

  getQueryString:
      返回的是Url参数

   getServletPath:
      返回的是/login.jsp


获取客户机的IP地址:--request.getRemoteAddr()-------127.0.0.1
获取客户机的主机名:--request.getRemoteHost()-------127.0.0.1
获取客户机的端口号:--request.getRemotePort()-------1373


服务器接收当前的网络接口的IP地址:--request.getLocalAddr()-------127.0.0.1
所对应的主机名:--request.getLocalName()-------localhost
对应的端口号:--request.getLocalPort()-------8080
获取当前请求所指向的主机名:--request.getServerName()-------localhost
获取当前请求的所连接的服务器端口号:--request.getServerPort()-------8080
获取请求的协议名:--request.getScheme()-------http




 

你可能感兴趣的:(jsp,Web,网络协议)