From b1f086a9b9c27c5d90f46014f024aa0a186ea598 Mon Sep 17 00:00:00 2001 From: noear Date: Thu, 26 May 2022 18:59:03 +0800 Subject: [PATCH] 1.8.1 --- .../solon/extend/staticfiles/XPluginImp.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/_solon_extend/solon.extend.staticfiles/src/main/java/org/noear/solon/extend/staticfiles/XPluginImp.java b/_solon_extend/solon.extend.staticfiles/src/main/java/org/noear/solon/extend/staticfiles/XPluginImp.java index e5716eaed7..f6cf7c7854 100644 --- a/_solon_extend/solon.extend.staticfiles/src/main/java/org/noear/solon/extend/staticfiles/XPluginImp.java +++ b/_solon_extend/solon.extend.staticfiles/src/main/java/org/noear/solon/extend/staticfiles/XPluginImp.java @@ -30,20 +30,18 @@ public void start(AopContext context) { StaticMappings.add("/", new ClassPathStaticRepository(XPluginProp.RES_STATIC_LOCATION)); } - //尝试启动静态代理 - if (StaticMappings.count() > 0) { - //1.加载自定义的mime - // - NvMap mimeTypes = Solon.cfg().getXmap("solon.mime"); - mimeTypes.forEach((k, v) -> { - StaticMimes.add("." + k, v); - }); - - - //2.切换代理(让静态文件优先) - HandlerPipeline pipeline = new HandlerPipeline(); - pipeline.next(new StaticResourceHandler()).next(Solon.app().handlerGet()); - Solon.app().handlerSet(pipeline); - } + //尝试启动静态代理(也可能在后面动态添加仓库) + + //1.加载自定义的mime + NvMap mimeTypes = Solon.cfg().getXmap("solon.mime"); + mimeTypes.forEach((k, v) -> { + StaticMimes.add("." + k, v); + }); + + + //2.切换代理(让静态文件优先) + HandlerPipeline pipeline = new HandlerPipeline(); + pipeline.next(new StaticResourceHandler()).next(Solon.app().handlerGet()); + Solon.app().handlerSet(pipeline); } }