request.getScheme()的使用方法
2015-07-31 14:20
543 查看
request.getScheme()的使用方法
博客分类:JSP & Web应用服务器Google
今天在修改bug时,发现程序使用了 request.getScheme() 。不明白是什么意思,在google 搜索了一下。现在明白了。整理如下:
1、request.getScheme() 返回当前链接使用的协议;比如,一般应用返回http;SSL返回https;
2、在程序中的应用如下:
Java代码
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
<base href="<%=basePath%>">
String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; <base href="<%=basePath%>">
3、复习一下request 的常用方法:
request.getSchema()可以返回当前页面使用的协议,http 或是 https;
request.getServerName()可以返回当前页面所在的服务器的名字;
request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是80;
request.getContextPath()可以返回当前页面所在的应用的名字;
相关文章推荐
- iOS UItableView通讯录
- easyUI验证validatebox
- 关于Android Stduio插件的问题
- UVA 1152 4 Values Whose Sum is Zero 和为0的4个值 (中途相遇)
- UI02_UIButton
- BlueDBM个人读感
- iOS-UI-07 代理的使用
- c# request了解一下
- HDOJ丶 1005(Number Sequence)
- error MSB8031 Building an MFC project for a non-Unicode character set is deprecated
- QT下ui类的this指针与ui指针
- guava (四)--集合中的FluentIterable类
- [XCode] XCode 6 中 UIPickerView 的简单示例
- 【iOS开发系列】物理仿真动画UIDynamic (1)
- hdu3450Counting Sequences 树状数组
- mysql 连接url中useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true 的作用
- easyui在java-itoo的管理流程
- Clique in the Divisibility Graph
- HTML 对象属性 property value 与 attribute value
- EasyUi 日历组件 datebox 开始时间与结束时间限制