添加 webp 格式

This commit is contained in:
thinkgem
2024-07-25 11:53:21 +08:00
parent fcf5d8a04c
commit 75e5e2765c
5 changed files with 11 additions and 22 deletions

View File

@@ -64,13 +64,8 @@ public class ServletUtils {
* </listener-class></listener> * </listener-class></listener>
*/ */
public static HttpServletRequest getRequest(){ public static HttpServletRequest getRequest(){
HttpServletRequest request = null;
try{ try{
request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); return ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
if (request == null){
return null;
}
return request;
}catch(Exception e){ }catch(Exception e){
return null; return null;
} }
@@ -83,16 +78,11 @@ public class ServletUtils {
* <filter-name>requestContextFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping> * <filter-name>requestContextFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>
*/ */
public static HttpServletResponse getResponse(){ public static HttpServletResponse getResponse(){
HttpServletResponse response = null;
try{ try{
response = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getResponse(); return ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getResponse();
if (response == null){
return null;
}
}catch(Exception e){ }catch(Exception e){
return null; return null;
} }
return response;
} }
/** /**
@@ -122,9 +112,8 @@ public class ServletUtils {
public static boolean isStaticFile(String uri){ public static boolean isStaticFile(String uri){
if (STATIC_FILE == null){ if (STATIC_FILE == null){
try { try {
throw new Exception("检测到“application.yml”中没有配置“web.staticFile”属性。" throw new Exception("检测到“application.yml”中没有配置“web.staticFile”属性。配置示例:\n#静态文件后缀\nweb.staticFile=" +
+ "配置示例:\n#静态文件后缀\nweb.staticFile=.css,.js,.png,.jpg,.gif," ".css,.js,.map,.png,.jpg,.gif,.jpeg,.webp,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2");
+ ".jpeg,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -660,7 +660,7 @@ web:
excludePathPatterns: ~ excludePathPatterns: ~
# 静态文件后缀,过滤静态文件,以提高访问性能。 # 静态文件后缀,过滤静态文件,以提高访问性能。
staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2 staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.webp,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2
# 静态资源缓存周期 Cache-Control单位秒1年 # 静态资源缓存周期 Cache-Control单位秒1年
staticCachePeriod: 31536000 staticCachePeriod: 31536000
@@ -722,7 +722,7 @@ file:
maxFileSize: '500*1024*1024' maxFileSize: '500*1024*1024'
# 设置允许上传的文件后缀(全局设置) # 设置允许上传的文件后缀(全局设置)
imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff, imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,webp,
mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv, mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,
fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk, fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk,

View File

@@ -163,7 +163,7 @@ $(function() {
fileNameInputId: '${p.fileNameInputId}', fileNameInputId: '${p.fileNameInputId}',
uploadType: '${p.uploadType}', uploadType: '${p.uploadType}',
maxFileSize: "#{isNotBlank(p.maxFileSize)?p.maxFileSize:@Global.getConfig('file.maxFileSize', '500*1024*1024')}", maxFileSize: "#{isNotBlank(p.maxFileSize)?p.maxFileSize:@Global.getConfig('file.maxFileSize', '500*1024*1024')}",
imageAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.imageAllowSuffixes", ".gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,")}', imageAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.imageAllowSuffixes", ".gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,webp,")}',
mediaAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.mediaAllowSuffixes", ".flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,")}', mediaAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.mediaAllowSuffixes", ".flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,")}',
fileAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.fileAllowSuffixes", ".doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,")}', fileAllowSuffixes: '${isNotBlank(p.allowSuffixes)?p.allowSuffixes:@Global.getConfig("file.fileAllowSuffixes", ".doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,")}',
chunked: "#{__info_type=='0'?false:@Global.getConfig('file.chunked', 'true')}", chunked: "#{__info_type=='0'?false:@Global.getConfig('file.chunked', 'true')}",

View File

@@ -801,7 +801,7 @@ web:
excludePathPatterns: ~ excludePathPatterns: ~
# # 静态文件后缀,过滤静态文件,以提高访问性能。 # # 静态文件后缀,过滤静态文件,以提高访问性能。
# staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2 # staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.webp,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2
# #
# # 静态文件后缀排除的url路径指定哪些uri路径不进行静态文件过滤。 # # 静态文件后缀排除的url路径指定哪些uri路径不进行静态文件过滤。
# staticFileExcludeUri: /druid/ # staticFileExcludeUri: /druid/
@@ -860,7 +860,7 @@ file:
# maxFileSize: '500*1024*1024' # maxFileSize: '500*1024*1024'
# #
# # 设置允许上传的文件后缀(全局设置) # # 设置允许上传的文件后缀(全局设置)
# imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff, # imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,webp,
# mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv, # mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,
# fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk, # fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk,
# #

View File

@@ -801,7 +801,7 @@ web:
excludePathPatterns: ~ excludePathPatterns: ~
# # 静态文件后缀,过滤静态文件,以提高访问性能。 # # 静态文件后缀,过滤静态文件,以提高访问性能。
# staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2 # staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.webp,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2
# #
# # 静态文件后缀排除的url路径指定哪些uri路径不进行静态文件过滤。 # # 静态文件后缀排除的url路径指定哪些uri路径不进行静态文件过滤。
# staticFileExcludeUri: /druid/ # staticFileExcludeUri: /druid/
@@ -860,7 +860,7 @@ file:
# maxFileSize: '500*1024*1024' # maxFileSize: '500*1024*1024'
# #
# # 设置允许上传的文件后缀(全局设置) # # 设置允许上传的文件后缀(全局设置)
# imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff, # imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,webp,
# mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv, # mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,
# fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk, # fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,.7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk,
# #