升级到4.9.22后自定义404失效

今天刚从4.9.19升级到4.9.22,发现自定义的404以及其他错误页面失效了,不再往自定义页面跳转,怎么个情况?

me.setError404View("/common/404.html");

现在取而代之的是系统内置的404页面。

Screenshot_1.png

评论区

halason

2022-04-15 14:16

public class NewErrorRender extends ErrorRender {
public NewErrorRender(int errorCode) {
super(errorCode);
}

@Override
public void render() {
if (viewOrJson == null) {
viewOrJson = errorViewMap.get(errorCode);
}

super.render();
}
}

重写继承的渲染类

halason

2022-04-15 14:17

public class NewRenderFactory extends RenderFactory {
@Override
public Render getFileRender(String fileName) {
return new NewFileRender(fileName);
}

@Override
public Render getFileRender(String fileName, String downloadFileName) {
return new NewFileRender(fileName, downloadFileName);
}

@Override
public Render getFileRender(File file) {
return new NewFileRender(file);
}

@Override
public Render getFileRender(File file, String downloadFileName) {
return new NewFileRender(file, downloadFileName);
}

@Override
public Render getRedirectRender(String url) {
return new NewRedirectRender(url);
}

@Override
public Render getRedirectRender(String url, boolean withQueryString) {
return new NewRedirectRender(url, withQueryString);
}

@Override
public Render getErrorRender(int errorCode) {
return new NewErrorRender(errorCode);
}
}

halason

2022-04-15 14:17

@Override
public void configConstant(Constants me) {

me.setError404View("/common/html404.html");
me.setError500View("/common/html500.html");
me.setError401View("/common/html401.html");
me.setError403View("/common/html403.html");
me.setErrorView(405, "/common/html405.html");
me.setRenderFactory(new NewRenderFactory());

}

Grover

2022-04-15 15:45

哪来的 升级到4.9.22?最新不是 升级到4.9.21?

happyboy

2022-04-15 19:08

@halason 发帖当天已经找波总沟通了,已经找到原因了,等待波总发新版。

happyboy

2022-04-15 19:11

@Grover 这里https://mvnrepository.com/,2022.4.5就已经推送了。

热门反馈

扫码入社