Skip to content

Commit

Permalink
1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed May 26, 2022
1 parent b6cb9f8 commit b1f086a
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit b1f086a

Please sign in to comment.