request.getScheme() 使用方法
今天在看代码时,发现程序使用了 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() 使用方法的更多相关文章
- request.getScheme() 使用方法(转)
今天在看代码时,发现程序使用了 request.getScheme() .不明白是什么意思,查了一下.结果整理如下: 1.request.getScheme() 返回当前链接使用的协议:一般应用返回h ...
- request.getScheme()的使用方法
今天在修改bug时,发现程序使用了 request.getScheme() .不明白是什么意思,在google 搜索了一下.现在明白了.整理如下: 1.request.getScheme() 返回当前 ...
- (转)Nginx SSL+tomcat集群,request.getScheme() 取到https正确的协议
转自http://www.cnblogs.com/interdrp/p/4881785.html 最近在做一个项目, 架构上使用了 Nginx +tomcat 集群, 且nginx下配置了SSL,to ...
- Nginx SSL+tomcat集群,request.getScheme() 取到https正确的协议
最近在做一个项目, 架构上使用了 Nginx +tomcat 集群, 且nginx下配置了SSL,tomcat no SSL,项目使用https协议 但是,明明是https url请求,发现 log里 ...
- request常用的方法
request方法综合:-- 返回请求方式:-request.getMethod()-----GET返回URI中的资源名称(位于URL中端口后的资源路径):-request.getRequestURI ...
- request.getScheme() 取到https正确的协议(转载)
最近在做一个项目, 架构上使用了 Nginx +tomcat 集群, 且nginx下配置了SSL,tomcat no SSL,项目使用https协议 但是,明明是https url请求,发现 log里 ...
- JSP中的:request.getScheme()+"://"+request.getServerName()+":"+request.getServer
String path = request.getContextPath(); String basePath = request.getScheme()+"://"+reque ...
- String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getSer
这其实就是 获得应用的根url,比如说你的应用的根路径是 http://localhost:8080,那么你列出的代码就是为basePath赋值为 http://localhost:8080.具体点: ...
- String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";作用!!!!!
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+re ...
随机推荐
- OpenGL3D图形、旋转、纹理、键盘移动、光照、滤波、透明(完整) 转自http://www.cnblogs.com/tiandsp/archive/2012/01/23/2329049.html
#include <windows.h> // Windows的头文件 #include <stdio.h> #include <gl\gl.h> // OpenG ...
- UIDatePicker 时间选择器
NSDate *currentTime = [NSDate date]; datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, ...
- 约束 CONSTRAINT
约束用于限制加入表中数据的类型 约束的种类: 非空约束(NOT NULL):约束列不接受NULL值,强制字段始终包含值. 唯一约束(UNIQUE):约束一列或一组列中的数据是唯一的.表中可以有多个唯一 ...
- [Spark]What's the difference between spark.sql.shuffle.partitions and spark.default.parallelism?
From the answer here, spark.sql.shuffle.partitions configures the number of partitions that are used ...
- Snownlp
from snownlp import SnowNLP text='宝贝自拍很帅!!!注意休息-' s=SnowNLP(text) #分词print(s.words) #词性for tag in s. ...
- openssl AES加密
此代码不涉及ECB和CBC等关联加密 #include <stdio.h> #include <string.h> #include <stdlib.h> #inc ...
- 找不到类SimpleJdbcTemplate ParameterizedRowMapper cannot be resolved
找不到类SimpleJdbcTemplate 背景 想编译个web应用,原来spring-jdbc.jar用的是Spring 3.1,今天改成用Spring 4.3,报了这个错误. 现象 编译不通过, ...
- 拖拽文件实现无刷新上传,支持2G文件
客户端 用HTML5:jQuery File Upload http://blueimp.github.io/jQuery-File-Upload/basic-plus.html API https: ...
- 【Linux】ApacheBench(ab)压力测试工具
AB的简介 ab是apachebench命令的缩写. ab是apache自带的压力测试工具.ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试.比 ...
- linux中命令突然不能用
先用:echo $PATH 发现path丢失:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 于是用临时环境变量 export ...