JFinal 配置类似.html这样的伪静态
程序员文章站
2024-02-12 12:36:52
...
创建一个FakeStaticHandler类即可搞定,且看这里:
public class FakeStaticHandler extends Handler {
public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
int index = target.lastIndexOf(".html");
if (index != -1)
target = target.substring(0, index);
nextHandler.handle(target, request, response, isHandled);
}
}
将上面的FakeStaticHandler在 YourJFinalConfig 中注册一下就可了:
public void configHandler(Handlers me) {
me.addHandler(new FakeStaticHandler());
}
转载于:https://my.oschina.net/i33/blog/84383
上一篇: C# Hook钩子实例代码 截取键盘输入