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

  • 相关阅读:
    文件限额
    Shell命令
    HDFS基本概念
    hadoop学习
    CentOS 5.6怎么安装MongoDB数据库?
    RHEL/CentOS 6.x使用EPEL6与remi的yum源安装MySQL 5.5.x
    centos6.x yum 安装 mysql5.6 mysql5.7
    Centos6.4环境下DNS服务器的搭建
    CentOS系统中使用iptables设置端口转发
    通过WEB网管登录
  • 原文地址:https://www.cnblogs.com/haw2106/p/7883999.html
Copyright © 2011-2022 走看看