use of alfio.util.DefaultExceptionHandler in project alf.io by alfio-event.
the class SpringBootLauncher method main.
/**
* Entry point for spring boot
* @param args original arguments
*/
public static void main(String[] args) {
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
String profiles = System.getProperty("spring.profiles.active", "");
SpringApplication application = new SpringApplication(SpringBootInitializer.class, BaseConfiguration.class, DataSourceConfiguration.class, WebSecurityConfig.class, MvcConfiguration.class);
List<String> additionalProfiles = new ArrayList<>();
additionalProfiles.add(Initializer.PROFILE_SPRING_BOOT);
if ("true".equals(System.getenv("ALFIO_LOG_STDOUT_ONLY"))) {
// -> will load application-stdout.properties on top to override the logger configuration
additionalProfiles.add("stdout");
}
if ("true".equals(System.getenv("ALFIO_DEMO_ENABLED"))) {
additionalProfiles.add(Initializer.PROFILE_DEMO);
}
application.setAdditionalProfiles(additionalProfiles.toArray(new String[0]));
ConfigurableApplicationContext applicationContext = application.run(args);
ConfigurableEnvironment environment = applicationContext.getEnvironment();
log.info("profiles: requested {}, active {}", profiles, String.join(", ", environment.getActiveProfiles()));
}
use of alfio.util.DefaultExceptionHandler in project alf.io by alfio-event.
the class Initializer method onStartup.
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
configureSessionCookie(servletContext);
CharacterEncodingFilter cef = new CharacterEncodingFilter();
cef.setEncoding("UTF-8");
cef.setForceEncoding(true);
Dynamic characterEncodingFilter = servletContext.addFilter("CharacterEncodingFilter", cef);
characterEncodingFilter.setAsyncSupported(true);
characterEncodingFilter.addMappingForUrlPatterns(null, false, "/*");
// force log initialization, then disable it
XRLog.setLevel(XRLog.EXCEPTION, Level.WARNING);
XRLog.setLoggingEnabled(false);
}
Aggregations