Set server on default handler

Fixes #9398 and #9322
This commit is contained in:
gregw 2023-02-20 19:22:11 +11:00
parent fb7b5d42ce
commit 3bdd75f682
2 changed files with 10 additions and 0 deletions

View File

@ -161,6 +161,8 @@ public class Server extends Handler.Wrapper implements Attributes
{
if (!isDynamic() && isStarted())
throw new IllegalStateException(getState());
if (defaultHandler != null)
defaultHandler.setServer(this);
Handler old = _defaultHandler;
_defaultHandler = defaultHandler;
updateBean(old, defaultHandler);

View File

@ -36,6 +36,7 @@ import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.Name;
@ -251,4 +252,11 @@ public class DefaultHandler extends Handler.Abstract
{
_showContexts = show;
}
@Override
public String toString()
{
String name = TypeUtil.toShortName(getClass());
return String.format("%s@%x{showContext=%b,favIcon=%b,%s}", name, hashCode(), _showContexts, _serveFavIcon, getState());
}
}