前端页面请求地址

<video id=example-video width=960 height=540 class="video-js vjs-default-skin" controls>
<source
src="/media2/course.m3u8"
type="application/x-mpegURL">
</video>

后台代码

    @RequestMapping(value = "/media2/{id}.m3u8")
public String m3u8Generator(@PathVariable("id") String id)
{
System.out.println(id);
return "xxx";
}

后台得到的id结果是course

解决方法

@Configuration
public class WebAppConfig extends WebMvcConfigurerAdapter { /***
* Using the @PathVariable on a Spring Boot controller, if a value contains a dot (‘.’) the value after the dot will be truncated.
* This happen since Spring MVC considers anything after the last dot as
* <a href="https://stackoverflow.com/questions/3526523/spring-mvc-pathvariable-getting-truncated">a file extension by default</a>.
*
* In order to avoid to getting truncated values it can be disabled this Spring MVC “feature” setting to false the
* useSuffixPatternMatch option through the PathMatchConfigurer:
* @param configurer
*/
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);
}
}

参考内容:

Spring MVC @PathVariable getting truncated

SPRING BOOT: AVOIDING PATHVARIABLE PARAMETERS GETTING TRUNCATED ON DOTS

请求路径@PathVariable注释中有点.英文句号的问题(忽略英文句号后面的后缀)的更多相关文章

  1. 请求路径@PathVariable与请求参数@RequestParam的区别

    转自:http://www.iteye.com/problems/101566: http://localhost:8080/Springmvc/user/page.do?pageSize=3& ...

  2. SpringMVC 请求路径结尾存在.使用@PathVariable访问路径内容,路径参数获取不准确的问题

    SpringMVC采用Get方式请求资源时,如果请求路径的结尾中带有小数点(.)时,同时使用@PathVariable访问路径内容时,请求路径中最后一个小数点及其后面的内容会被Spring截断丢弃比如 ...

  3. SpringMVC实现文件下载时,请求路径中的扩展名被省略

    问题描述 问题是这样的,我写了一个DownloadController,用来处理下载请求,预期效果如下: 客户端浏览器在访问URL -->   http://localhost:8080/ssm ...

  4. jmeter接口测试-GET请求路径中包含特殊字符或中文导致Response400报错

    问题描述:接口测试中异常用例GET请求路径中包含特殊字符或中文,运行jmeter会报错,取样器中只能看到Response400,响应结果为空 解决思路: 对于通过BODY发送的中文内容可以用Jmete ...

  5. Spring中统一相同版本的api请求路径的一些思考

    Spring中统一相同版本的api请求路径的一些思考 问题场景 当我们在实际开发中,可能会遇到开发相同同版本的api, 假设相同版本的api请求路径为/v1/functionA,/v1/functio ...

  6. Spring Boot 2.x基础教程:找回启动日志中的请求路径列表

    如果您看过之前的Spring Boot 1.x教程,或者自己原本就对Spring Boot有一些经验,或者对Spring MVC很熟悉.那么对于Spring构建的Web应用在启动的时候,都会输出当前应 ...

  7. Javaweb中的请求路径的相关总结

    重定向和转发相对路径和绝对路径问题 ​ 注意:转发和重定向的URLString前有加 / 为绝对路径 反之为相对路径 1.假设通过表单请求指定的Url资源 action="LoginServ ...

  8. 【Servlet】—在servlet中常混的请求路径

    在页面请求,后台获取相关请求路径是,自己长搞混的几个路径,再次做次标记,不要每次使用想不起来是,都去写一个小的demo来测试. request.getContextPath(); request.ge ...

  9. vue-cli项目 build后请求本地static文件中的 json数据,路径不对,报错404处理方法

    vue-cli 项目 build  出错点: 1,build生成dist 放在tomcat上 报错,不显示内容  解决办法: config>index.js===>assetsPublic ...

随机推荐

  1. redis——持久化策略

    4.2.2 持久 化方式(1 ) RDB 方式1. 什么是 RDB 方式?Redis Database(RDB),就是在指定的时间间隔内将内存中的数据集快照写入磁盘,数据恢复时将快照文件直接再读到内存 ...

  2. 作业十一——LL(1)文法的判断

    1. 文法 G(S): (1)S -> AB (2)A ->Da|ε (3)B -> cC (4)C -> aADC |ε (5)D -> b|ε 验证文法 G(S)是不 ...

  3. [GDOI2014]采集资源

    题目概述 题目描述 魔兽争霸3中,战略资源的采集通过使用农民.苦工.小精灵以及寺僧来进行. 在魔兽争霸4的开发中,玻璃渣觉得这种模式太过单一,于是他们想添加更多的单位来使采集的模式更加丰富. 在新的模 ...

  4. 《流畅的Python》Object References, Mutability, and Recycling--第8章

    Object References, Mutability, and Recycling 本章章节: Variables Are Not Boxes identity , Equality ,  Al ...

  5. 算法设计与分析 - 李春葆 - 第二版 - html v2

    1 .1 第 1 章─概论   1.1.1 练习题   1 . 下列关于算法的说法中正确的有( ).   Ⅰ Ⅱ Ⅲ Ⅳ .求解某一类问题的算法是唯一的   .算法必须在有限步操作之后停止   .算法 ...

  6. Property or method "openPageOffice" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by

    Property or method "openPageOffice" is not defined on the instance but referenced during r ...

  7. informix创建同义词

    搜索词条 1.informix不同主机的数据库同义词创建? 2.informix怎么实现跨服务器数据抽取? 3.informix 数据库跨库访问的配置?https://blog.csdn.net/Da ...

  8. dpkg: error processing package XXX (--configure) 解决方法 (ubuntu右上角红色警告)

    在 Ubuntu 执行 sudo apt-get upgrade 时,出现了如下的报错: Setting up bluez (4.101-0ubuntu13.1) ... reload: Job is ...

  9. Java分布式互联网架构/微服务/高性能/springboot/springcloud 2018年10月17日直播内容

    2018年10月17日直播内容 大规模并发必备的消息中间件技术ActiveMq 网盘链接: https://pan.baidu.com/s/1GlxsZ2JnrvX- YN16-S7lQw 提取码: ...

  10. Win内核原理与实现学习笔记1-windows内核版本列表