com.rollbar.spring.boot.webmvc.RollbarServletContextInitializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rollbar-spring-boot-webmvc Show documentation
Show all versions of rollbar-spring-boot-webmvc Show documentation
For connecting your applications built on the JVM to Rollbar for Error Reporting
The newest version!
package com.rollbar.spring.boot.webmvc;
import com.rollbar.web.listener.RollbarRequestListener;
import javax.servlet.ServletContext;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.stereotype.Component;
@Component
public class RollbarServletContextInitializer implements ServletContextInitializer {
/**
* Adds RollbarListener when app starts up. This enriches HTTP request data
* with Rollbar exceptions. You can view this data from the Rollbar app.
*/
@Override
public void onStartup(ServletContext container) {
// Attach the RollbarRequestListner to attribute HTTP Request data into the Exception object
// This will be visible in Rollbar
container.addListener(RollbarRequestListener.class);
}
}