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

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

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

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()可以返回当前页面所在的应用的名字;
---------------------
转自https://blog.csdn.net/zy18729286306/article/details/21593721

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. arcpy 获得是否为布局mxd.activeView

    arcpy 获得是否为布局mxd.activeView print mxd.activeView PAGE_LAYOUT mxd.pageSizePageSize(width=21.590043180 ...

  2. Highcharts 使用总结

    一.Highcharts  series属性 1.下面是一个基本曲线图的例子: <html> <head> <meta charset="UTF-8" ...

  3. multiprocessing.Pool报pickling error

    multiprocessing.Pool报pickling error 现象 multiprocessing.Pool传递一个普通方法(不在class中定义的)时, 能正常工作. from multi ...

  4. Flask中路由参数

    Flask中路由参数.请求方式设置 一.参数设置 1.参数类型 Flask中参数的使用 @app.route('/parames/<username>/') def hello_world ...

  5. layer弹框层学习笔记

    这里对layer的笔记只是大概记录一下其使用过程,以便后续使用时快速回顾,更详细使用及介绍参考官网实例.链接在本文末 一 .初步了解layer-弹层之美 layer是一款近年来备受青睐的web弹层组件 ...

  6. php命令行模式下加载的php.ini文件可能和web模式下加载的php.ini不一致

    php命令行模式下加载的php.ini文件可能和web模式下加载的php.ini不一致 命令行下查看加载的php.ini的路径: php -i|grep php.ini web模式下查看: <? ...

  7. 解决Python-OpenCV中cv2.rectangle报错

    在PyTorch中测试DataLoader读取后的图像,对图像画框cv2.rectangle时报错: TypeError: Layout of the output array img is inco ...

  8. springMVC配置文件学习

    spring配置文件分为dao层,web层,service层,三层配置 这三层配置中, dao层对应数据库的配置:进行数据库相关和model实体类的配置 web层对应controller包中配置:设置 ...

  9. Jmeter安装及配置(傻瓜模式)

    接下来将以傻瓜模式进行安装,跟着流程走,没错的~ 1.首先进入到apache官网https://www.apache.org/dist/jmeter/binaries下载Windows版本JMeter ...

  10. OpenGL.资料积累

    1.又一种Qt + OpenGL 的离屏渲染方法 - liji_digital的博客 - CSDN博客.html(https://blog.csdn.net/liji_digital/article/ ...