Java Code Examples for org.springframework.boot.web.servlet.ServletListenerRegistrationBean#setListener()

The following examples show how to use org.springframework.boot.web.servlet.ServletListenerRegistrationBean#setListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringBootConfiguration.java    From bugsnag-java with MIT License 5 votes vote down vote up
/**
 * The {@link com.bugsnag.servlet.BugsnagServletContainerInitializer} does not work for Spring Boot, need to
 * register the {@link BugsnagServletRequestListener} using a Spring Boot
 * {@link ServletListenerRegistrationBean} instead. This adds session tracking and
 * automatic servlet request metadata collection.
 */
@Bean
@Conditional(SpringWebMvcLoadedCondition.class)
ServletListenerRegistrationBean<ServletRequestListener> listenerRegistrationBean() {
    ServletListenerRegistrationBean<ServletRequestListener> srb =
            new ServletListenerRegistrationBean<ServletRequestListener>();
    srb.setListener(new BugsnagServletRequestListener());
    return srb;
}
 
Example 2
Source File: WebMvcConfig.java    From SpringBoot2.0 with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<MyListener1> registrationBean() {
    ServletListenerRegistrationBean<MyListener1> servletListenerRegistrationBean
            = new ServletListenerRegistrationBean<>();
    servletListenerRegistrationBean.setListener(new MyListener1());
    return servletListenerRegistrationBean;
}
 
Example 3
Source File: CasConfiguration.java    From taoshop with Apache License 2.0 5 votes vote down vote up
/**
 * 单点登出监听器
 * @return
 */
@Bean
public ServletListenerRegistrationBean servletListenerRegistrationBean() {
    ServletListenerRegistrationBean registrationBean = new ServletListenerRegistrationBean();
    registrationBean.setListener(new SingleSignOutHttpSessionListener());
    registrationBean.setEnabled(true);
    return registrationBean;
}
 
Example 4
Source File: CasCustomConfig.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<SingleSignOutHttpSessionListener>();
    listener.setEnabled(casEnabled);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 5
Source File: CasCustomConfig.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<SingleSignOutHttpSessionListener>();
    listener.setEnabled(casEnabled);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 6
Source File: CasCustomConfig.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<SingleSignOutHttpSessionListener>();
    listener.setEnabled(casEnabled);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 7
Source File: ShiroConfiguration.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
/**
 * 注册单点登出的listener
 * 
 * @return
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Bean
public ServletListenerRegistrationBean<?> singleSignOutHttpSessionListener() {
	ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();
	bean.setListener(new SingleSignOutHttpSessionListener());
	bean.setEnabled(true);
	return bean;
}
 
Example 8
Source File: CasConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
/**
 *  For single point logout
 */
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
    listener.setEnabled(true);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 9
Source File: CasConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
/**
 *  For single point logout
 */
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
    listener.setEnabled(true);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 10
Source File: CasConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
/**
 *  For single point logout
 */
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
    listener.setEnabled(true);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 11
Source File: CasConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
/**
 *  For single point logout
 */
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
    listener.setEnabled(true);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 12
Source File: CasConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
/**
 *  For single point logout
 */
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
    ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
    listener.setEnabled(true);
    listener.setListener(new SingleSignOutHttpSessionListener());
    listener.setOrder(1);
    return listener;
}
 
Example 13
Source File: AuthConfiguration.java    From apollo with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletListenerRegistrationBean redisAppSettingListner() {
  ServletListenerRegistrationBean redisAppSettingListener = new ServletListenerRegistrationBean();
  redisAppSettingListener
      .setListener(listener("org.jasig.cas.client.credis.CRedisAppSettingListner"));
  return redisAppSettingListener;
}
 
Example 14
Source File: ShutdownHookConfiguration.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
ServletListenerRegistrationBean<ServletContextListener> servletListener() {
    ServletListenerRegistrationBean<ServletContextListener> srb = new ServletListenerRegistrationBean<>();
    srb.setListener(new ExampleServletContextListener());
    return srb;
}
 
Example 15
Source File: SpringWebConfig.java    From we-cmdb with Apache License 2.0 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<ServletRequestListener> registerRequestListener() {
    ServletListenerRegistrationBean<ServletRequestListener> servletListenerRegistrationBean = new ServletListenerRegistrationBean<>();
    servletListenerRegistrationBean.setListener(new RequestContextListener());
    return servletListenerRegistrationBean;
}
 
Example 16
Source File: RESTCXFContext.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<ServletRequestListener> listenerRegistrationBean() {
    ServletListenerRegistrationBean<ServletRequestListener> bean = new ServletListenerRegistrationBean<>();
    bean.setListener(new ThreadLocalCleanupListener());
    return bean;
}
 
Example 17
Source File: LayuiAdminStartUp.java    From layui-admin with MIT License 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean IntrospectorCleanupListener(){
    ServletListenerRegistrationBean servletListenerRegistrationBean = new ServletListenerRegistrationBean();
    servletListenerRegistrationBean.setListener(new org.springframework.web.util.IntrospectorCleanupListener());
    return servletListenerRegistrationBean;
}
 
Example 18
Source File: WebConfiguration.java    From spring-boot-demo with MIT License 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean customRequestListener() {
    ServletListenerRegistrationBean srb = new ServletListenerRegistrationBean();
    srb.setListener(new CustomRequestListener());
    return srb;
}
 
Example 19
Source File: WebConfiguration.java    From spring-boot-demo with MIT License 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean customSessionListener() {
    ServletListenerRegistrationBean srb = new ServletListenerRegistrationBean();
    srb.setListener(new CustomSessionListener());
    return srb;
}