今天在看代码时,发现程序使用了 request.getScheme() 。不明白是什么意思,查了一下。结果整理如下:

1、request.getScheme() 返回当前链接使用的协议;一般应用返回http;SSL返回https;

2、在程序中的应用如下:

3、复习一下request 的常用方法:

request.getSchema()可以返回当前页面使用的协议,http 或是 https;

request.getServerName()可以返回当前页面所在的服务器的名字;

request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是80;

request.getContextPath()可以返回当前页面所在的应用的名字;

<html>
<head>
<base href="http://www.w3school.com.cn/i/" />
</head>

运行结果

<body>
<img src="eg_smile.gif" /><br />
<p>请注意,我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL,浏览器将在如下地址寻找图片:</p>
<p>"http://www.w3school.com.cn/i/eg_smile.gif"</p>
</body>
</html>

请注意,我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL,浏览器将在如下地址寻找图片:

"http://www.w3school.com.cn/i/eg_smile.gif"

request.getScheme() 使用方法的更多相关文章

  1. request.getScheme() 使用方法(转)

    今天在看代码时,发现程序使用了 request.getScheme() .不明白是什么意思,查了一下.结果整理如下: 1.request.getScheme() 返回当前链接使用的协议:一般应用返回h ...

  2. request.getScheme()的使用方法

    今天在修改bug时,发现程序使用了 request.getScheme() .不明白是什么意思,在google 搜索了一下.现在明白了.整理如下: 1.request.getScheme() 返回当前 ...

  3. (转)Nginx SSL+tomcat集群,request.getScheme() 取到https正确的协议

    转自http://www.cnblogs.com/interdrp/p/4881785.html 最近在做一个项目, 架构上使用了 Nginx +tomcat 集群, 且nginx下配置了SSL,to ...

  4. Nginx SSL+tomcat集群,request.getScheme() 取到https正确的协议

    最近在做一个项目, 架构上使用了 Nginx +tomcat 集群, 且nginx下配置了SSL,tomcat no SSL,项目使用https协议 但是,明明是https url请求,发现 log里 ...

  5. request常用的方法

    request方法综合:-- 返回请求方式:-request.getMethod()-----GET返回URI中的资源名称(位于URL中端口后的资源路径):-request.getRequestURI ...

  6. request.getScheme() 取到https正确的协议(转载)

    最近在做一个项目, 架构上使用了 Nginx +tomcat 集群, 且nginx下配置了SSL,tomcat no SSL,项目使用https协议 但是,明明是https url请求,发现 log里 ...

  7. JSP中的:request.getScheme()+"://"+request.getServerName()+":"+request.getServer

    String path = request.getContextPath();  String basePath = request.getScheme()+"://"+reque ...

  8. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getSer

    这其实就是 获得应用的根url,比如说你的应用的根路径是 http://localhost:8080,那么你列出的代码就是为basePath赋值为 http://localhost:8080.具体点: ...

  9. String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";作用!!!!!

    <%String path = request.getContextPath();String basePath = request.getScheme()+"://"+re ...

随机推荐

  1. java学习笔记1--基础知识

    1.java数据类型 2.类之间的几种关系

  2. Linux下网络排查之ping|traceroute|mtr工具(zz)

      1.ping ping使用了ICMP回送请求和回送应答报文.ping工具发出去的数据包没有通过tcp/udp协议,但是要经过ip协议.ping命令计算的时间是数据包的往返总时间. ping命令常用 ...

  3. javascript 高级程序设计 七

    引言:好几天没有写随笔了,项目有点紧,恰好今天项目遇到了比较大阻塞,就只好来写一篇随笔来压压惊. 1.Date类型 创建一个新的Date:(除了new Date()外) var someDate = ...

  4. 在tableviewcell里面嵌入switch控件以及如何获取switch控件数据

    主要是通过cell.accessoryView来添加switch控件- (UITableViewCell *)tableView:(UITableView *)tableView cellForRow ...

  5. 品味性能之道<九>:利用Loadrunner编写socket性能测试脚本简述

            一.概述         Loadrunner拥有极为丰富的工具箱,供予我们制造出各种奇妙魔法的能力.其中就有此次要讨论的socket套接字操作.     二.socket概述     ...

  6. django基础使用

    //创建应用 python3 manage.py startapp mysite //开启服务 python3 manage.py runserver 127.0.0.1:8080 //创建数据库命令 ...

  7. Spring ApplicationContext(十)finishRefresh

    ApplicationContext(十)finishRefresh Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) 经过 ...

  8. .NET获取城市信息(将三字代码转换成城市名)

    整理代码,发现有一个从两张表里读取城市列表,然后linq和lambda表达式来获取城市名的函数,代码如下: public static string GetCityHotelText(string c ...

  9. web.xml 详细介绍(zz)

    web.xml 详细介绍 博客分类: CoreJava WebXMLServletJSPTomcat  http://mianhuaman.iteye.com/blog/1105522 1.启动一个W ...

  10. QualNet/EXata的发展贯穿在美军网络中心战演进的始终

    QualNet/EXata的发展贯穿在美军网络中心战演进的始终 赵玉亭 1.   QualNet/EXata的前身GloMoSim是美国防部高级计划研究局(DARPA)在1994年启动的全球移动信息系 ...