Merge remote-tracking branch 'origin/jetty-12.0.x-fix-servletcontext' into jetty-12.0.x

This commit is contained in:
Jan Bartel 2022-06-02 13:03:01 +10:00
commit b4e59bc4a7
2 changed files with 12 additions and 14 deletions

View File

@ -193,7 +193,7 @@ public class ServletContextHandler extends ContextHandler implements Graceful
public interface ServletContainerInitializerCaller extends LifeCycle {}
private Class<? extends SecurityHandler> _defaultSecurityHandlerClass = ConstraintSecurityHandler.class;
private final ServletContextApi _servletContext = new ServletContextApi();
private final ServletContextApi _servletContext;
protected ContextStatus _contextStatus = ContextStatus.NOTSET;
private final Map<String, String> _initParams = new HashMap<>();
private boolean _contextPathDefault = true;
@ -272,6 +272,8 @@ public class ServletContextHandler extends ContextHandler implements Graceful
public ServletContextHandler(Container parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler, int options)
{
_servletContext = newServletContextApi();
if (File.separatorChar == '/')
addAliasCheck(new SymlinkAllowedResourceAliasChecker(this));
@ -299,6 +301,11 @@ public class ServletContextHandler extends ContextHandler implements Graceful
setErrorHandler(errorHandler);
*/
}
public ServletContextApi newServletContextApi()
{
return new ServletContextApi();
}
@Override
public void dump(Appendable out, String indent) throws IOException
@ -3267,7 +3274,7 @@ public class ServletContextHandler extends ContextHandler implements Graceful
}
public boolean isExtendedListenerTypes()
{
{
return _extendedListenerTypes;
}

View File

@ -41,6 +41,7 @@ import jakarta.servlet.http.HttpSessionListener;
import org.eclipse.jetty.ee10.servlet.ErrorHandler;
import org.eclipse.jetty.ee10.servlet.ErrorPageErrorHandler;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler.ServletContextApi;
import org.eclipse.jetty.ee10.servlet.ServletHandler;
import org.eclipse.jetty.ee10.servlet.SessionHandler;
import org.eclipse.jetty.ee10.servlet.security.ConstraintAware;
@ -137,7 +138,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
private boolean _throwUnavailableOnStartupException = false;
private MetaData _metadata = new MetaData();
private ServletApiContext _servletApiContext = new ServletApiContext();
public static WebAppContext getCurrentWebAppContext()
{
@ -824,9 +824,9 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
}
@Override
protected ContextHandler.Context newContext()
public ServletContextApi newServletContextApi()
{
return new Context();
return new WebAppContext.ServletApiContext();
}
@Override
@ -1400,15 +1400,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
}
}
public class Context extends ServletContextHandler.Context
{
@Override
public ServletContextApi getServletContext()
{
return _servletApiContext;
}
}
public MetaData getMetaData()
{
return _metadata;