change: 修改一下代码

This commit is contained in:
1719411461@qq.com 2018-05-08 19:47:04 +08:00
parent 803b4fcbd1
commit 5b060c3636

View File

@ -18,6 +18,7 @@ import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
@ -194,14 +195,12 @@ public class JettyStarter extends AbstractServletContainerStarter implements Ser
wac.getServletContext().setExtendedListenerTypes(true);
wac.getSessionHandler().setMaxInactiveInterval(getSessionTimeout());
List<ErrorPageErrorHandler> errorHandlers = appContext.getBeans(ErrorPageErrorHandler.class);
ErrorPageErrorHandler ep;
if(errorHandlers.size() > 0){
ep = errorHandlers.get(0);
}else{
ep = new ErrorPageErrorHandler();
ErrorHandler ep = Lang.first(appContext.getBeans(ErrorHandler.class));
if(ep == null){
ErrorPageErrorHandler handler = new ErrorPageErrorHandler();
handler.setErrorPages(getErrorPages());
ep = handler;
}
ep.setErrorPages(getErrorPages());
wac.setErrorHandler(ep);
// 设置一下额外的东西