use of org.eclipse.jetty.webapp.AbstractConfiguration in project spring-boot by spring-projects.
the class JettyServletWebServerFactoryTests method errorHandlerCanBeOverridden.
@Test
void errorHandlerCanBeOverridden() {
JettyServletWebServerFactory factory = getFactory();
factory.addConfigurations(new AbstractConfiguration() {
@Override
public void configure(WebAppContext context) throws Exception {
context.setErrorHandler(new CustomErrorHandler());
}
});
JettyWebServer jettyWebServer = (JettyWebServer) factory.getWebServer();
WebAppContext context = findWebAppContext(jettyWebServer);
assertThat(context.getErrorHandler()).isInstanceOf(CustomErrorHandler.class);
}
use of org.eclipse.jetty.webapp.AbstractConfiguration in project spring-boot by spring-projects.
the class JettyServletWebServerFactory method getErrorPageConfiguration.
/**
* Create a configuration object that adds error handlers.
* @return a configuration object for adding error pages
*/
private Configuration getErrorPageConfiguration() {
return new AbstractConfiguration() {
@Override
public void configure(WebAppContext context) throws Exception {
ErrorHandler errorHandler = context.getErrorHandler();
context.setErrorHandler(new JettyEmbeddedErrorHandler(errorHandler));
addJettyErrorPages(errorHandler, getErrorPages());
}
};
}
Aggregations