zoukankan      html  css  js  c++  java
  • request常用的方法

     request方法综合:--

    返回请求方式:-request.getMethod()-----GET
    返回URI中的资源名称(位于URL中端口后的资源路径):-request.getRequestURI()-----/myservlet/RequestMethodColligate.html
    返回URL中的参数部分:-request.getQueryString()-----null
    返回URL中的协议名:-request.getProtocol()-----HTTP/1.1
    返回所属于的路径WEB站点:-request.getContextPath()-----/myservlet
    返回额外信息路径:-request.getPathInfo()-----null
    返回额外信息所对应的资源的真实路径:-request.getPathTranslated()-----null
    返回SERVLET所映射的路径在XML文档中设置:-request.getServletPath()-----/RequestMethodColligate.html


    -----------------------------------------------


    以下为获取网络连接信息,在ServletRequest接口的方法综合实例:------


    ------获取客户机上的有:---
    获取客户机的IP地址:--request.getRemoteAddr()-------127.0.0.1
    获取客户机的主机名:--request.getRemoteHost()-------127.0.0.1
    获取客户机的端口号:--request.getRemotePort()-------1373
    获取客户机发出请求时的完整URL:--request.getRequestURL()-------http://localhost:8080/myservlet/RequestMethodColligate.html


    ------以下为获取本地服务器中的网络信息有:-----


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

  • 相关阅读:
    小朋友的责任 转自点妈文集
    amazon.cn, 感觉不错
    团队作业1——团队展示&选题
    如何解决mysql中的账户添加后不能登录的问题
    目标检测中常见指标
    latex知识点
    考研复试建议
    论文写作经验
    Git
    Python编程知识
  • 原文地址:https://www.cnblogs.com/haw2106/p/7883999.html
Copyright © 2011-2022 走看看