All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rollbar.spring.boot.webmvc.RollbarServletContextInitializer Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha.1
Show 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);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy