Java Code Examples for org.springframework.boot.web.servlet.ServletListenerRegistrationBean

The following examples show how to use org.springframework.boot.web.servlet.ServletListenerRegistrationBean. These examples are extracted from open source projects. 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 Project: SpringBoot2.0   Source File: WebMvcConfig.java    License: 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 2
Source Project: taoshop   Source File: CasConfiguration.java    License: 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 3
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
	ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> registration = new ServletListenerRegistrationBean<SingleSignOutHttpSessionListener>(
			new SingleSignOutHttpSessionListener());
	registration.setOrder(1);
	return registration;
}
 
Example 4
Source Project: CAS   Source File: CasCustomConfig.java    License: 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 Project: CAS   Source File: CasCustomConfig.java    License: 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 Project: CAS   Source File: CasCustomConfig.java    License: 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 Project: springboot-shiro-cas-mybatis   Source File: ShiroConfiguration.java    License: 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 Project: Spring-Security-Third-Edition   Source File: CasConfig.java    License: 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 Project: Spring-Security-Third-Edition   Source File: CasConfig.java    License: 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 Project: Spring-Security-Third-Edition   Source File: CasConfig.java    License: 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 Project: Spring-Security-Third-Edition   Source File: CasConfig.java    License: 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 Project: Spring-Security-Third-Edition   Source File: CasConfig.java    License: 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 Project: apollo   Source File: AuthConfiguration.java    License: 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 Project: javamelody   Source File: JavaMelodyAutoConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Registers the JavaMelody {@link SessionListener}.
 * @param servletContext ServletContext
 * @return ServletListenerRegistrationBean
 */
@Bean
public ServletListenerRegistrationBean<EventListener> monitoringSessionListener(
		ServletContext servletContext) {
	final ServletListenerRegistrationBean<EventListener> servletListenerRegistrationBean = new ServletListenerRegistrationBean<>(
			new SessionListener());
	if (servletContext.getFilterRegistration("javamelody") != null) {
		// if webapp deployed as war in a container with MonitoringFilter and SessionListener already added by web-fragment.xml,
		// do not add again
		servletListenerRegistrationBean.setEnabled(false);
	}
	return servletListenerRegistrationBean;
}
 
Example 15
Source Project: bugsnag-java   Source File: SpringBootConfiguration.java    License: 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 16
Source Project: we-cmdb   Source File: SpringWebConfig.java    License: 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 17
Source Project: spring-boot-demo   Source File: WebConfiguration.java    License: MIT License 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean customSessionListener() {
    ServletListenerRegistrationBean srb = new ServletListenerRegistrationBean();
    srb.setListener(new CustomSessionListener());
    return srb;
}
 
Example 18
Source Project: spring-boot-demo   Source File: WebConfiguration.java    License: 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 Project: MeetingFilm   Source File: WebConfig.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * RequestContextListener注册
 */
@Bean
public ServletListenerRegistrationBean<RequestContextListener> requestContextListenerRegistration() {
    return new ServletListenerRegistrationBean<>(new RequestContextListener());
}
 
Example 20
Source Project: MeetingFilm   Source File: WebConfig.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * ConfigListener注册
 */
@Bean
public ServletListenerRegistrationBean<ConfigListener> configListenerRegistration() {
    return new ServletListenerRegistrationBean<>(new ConfigListener());
}
 
Example 21
Source Project: WebStack-Guns   Source File: WebConfig.java    License: MIT License 4 votes vote down vote up
/**
 * RequestContextListener注册
 */
@Bean
public ServletListenerRegistrationBean<RequestContextListener> requestContextListenerRegistration() {
    return new ServletListenerRegistrationBean<>(new RequestContextListener());
}
 
Example 22
Source Project: WebStack-Guns   Source File: WebConfig.java    License: MIT License 4 votes vote down vote up
/**
 * ConfigListener注册
 */
@Bean
public ServletListenerRegistrationBean<ConfigListener> configListenerRegistration() {
    return new ServletListenerRegistrationBean<>(new ConfigListener());
}
 
Example 23
Source Project: ml-blog   Source File: SpringmvcConfiguration.java    License: MIT License 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<GlobalListener> servletListenerRegistrationBean() {
    return new ServletListenerRegistrationBean<>(globalListener);
}
 
Example 24
Source Project: springbootexamples   Source File: WebApplicationConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public ServletListenerRegistrationBean<ApplicationListener>  userServlet(){
	return new ServletListenerRegistrationBean<ApplicationListener> (new ApplicationListener());
}
 
Example 25
Source Project: Guns   Source File: WebConfig.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * RequestContextListener注册
 */
@Bean
public ServletListenerRegistrationBean<RequestContextListener> requestContextListenerRegistration() {
    return new ServletListenerRegistrationBean<>(new RequestContextListener());
}
 
Example 26
Source Project: Guns   Source File: WebConfig.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * ConfigListener注册
 */
@Bean
public ServletListenerRegistrationBean<ConfigListener> configListenerRegistration() {
    return new ServletListenerRegistrationBean<>(new ConfigListener());
}
 
Example 27
Source Project: sanshanblog   Source File: WebConfig.java    License: Apache License 2.0 4 votes vote down vote up
/**
  * 允许请求到外部的Listener
  * @return
  */
@Bean
public ServletListenerRegistrationBean<RequestContextListener> requestContextListener(){
    return new ServletListenerRegistrationBean<RequestContextListener>(new RequestContextListener());
}
 
Example 28
Source Project: sanshanblog   Source File: WebConfig.java    License: Apache License 2.0 4 votes vote down vote up
/**
  * 主要负责处理由 JavaBeans Introspector的使用而引起的缓冲泄露
  * @return
  */
@Bean
public ServletListenerRegistrationBean<IntrospectorCleanupListener> introspectorCleanupListener() {
     return  new ServletListenerRegistrationBean<>(new IntrospectorCleanupListener());
}
 
Example 29
Source Project: layui-admin   Source File: LayuiAdminStartUp.java    License: 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 30
Source Project: hasor   Source File: WebHasorConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnClass(name = "net.hasor.web.startup.RuntimeListener")
public ServletListenerRegistrationBean<?> hasorRuntimeListener() {
    Objects.requireNonNull(this.appContext, "AppContext is not inject.");
    return new ServletListenerRegistrationBean<>(new RuntimeListener(this.appContext));
}