当前位置:网站首页>7.2.2 compressing static resources through gzipresourceresolver
7.2.2 compressing static resources through gzipresourceresolver
2020-11-06 01:14:00 【Memory】
All the source code in the project can be found in the linked repository :https://github.com/chenhaoxiang/uifuture-ssm
List of articles
7.2.2 adopt GzipResourceResolver Compress static resources
The previous use of cache , But the first time the file is loaded, it will not go to the cache . In order to reduce the amount of data transferred , In this case, resource compression is needed . Modern browsers , Basically, it's all about supporting gzip Agreed , Support client decompression processing , The main purpose is to reduce the amount of transmission , Speed up . For example, put the front of bootstrap.css Compress it into bootstrap.css.gz.
GZIP Compression is Linux The compression method commonly used in . stay Linux Under the system , You can use the command to recurse the files in the directory and compress each file in the directory separately .”gzip -r /java/static/”, That is, traversal compression /java/static/ All the files in the directory . Be careful , The source file will be deleted .
But in the case of files being compressed , If you load directly bootstrap.css,Spring MVC It can't be handled normally , We hope to ask for bootstrap.css When it's time to return correctly bootstrap.css.gz. At this time, you need to add a resource parser to handle compression (GzipResourceResolver).
Code list 7-16:MvcConfig Class addResourceHandlers Method
版权声明
本文为[Memory]所创,转载请带上原文链接,感谢
边栏推荐
猜你喜欢
随机推荐
基础知识点整理
Probabilistic linear regression with uncertain weights
windows10 tensorflow(二)原理实战之回归分析,深度学习框架(梯度下降法求解回归参数)
架构文章搜集
9.2.1 xmlconfigbuilder constructor (xmlconfigbuilder analysis) - SSM in depth analysis and project practice
Skywalking系列博客1-安装单机版 Skywalking
VUEJS开发规范
5.4 静态资源映射 -《SSM深入解析与项目实战》
NodeJs爬虫抓取古代典籍,共计16000个页面心得体会总结及项目分享
Python 基于jwt实现认证机制流程解析
二叉树的常见算法总结
GDB调试基础使用方法
vite + ts 快速搭建 vue3 專案 以及介紹相關特性
iptables基础原理和使用简介
經典動態規劃:完全揹包問題
9.2.5 environmentslelement method (XML configuration builder analysis) - SSM in depth analysis and project practice
8.2.3 implementation of interceptors (interceptors and filters) through handlerinterceptor
业务策略、业务规则、业务流程和业务主数据之间关系 - modernanalyst
深度解读智能推荐系统搭建之路 | 会展云技术揭秘
普通算法面试已经Out啦!机器学习算法面试出炉 - kdnuggets