eventlistener.java
来自「CAS在Tomcat中实现单点登录项目,单点登录(Single Sign On 」· Java 代码 · 共 58 行
JAVA
58 行
/* * Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.ja-sig.org/products/cas/overview/license/ */package org.jasig.cas.event;import java.util.List;import org.jasig.cas.util.annotation.NotEmpty;import org.springframework.context.ApplicationEvent;import org.springframework.context.ApplicationListener;/** * Implementation of an ApplicationListener that listens specifically for events * within the CAS domain. Upon receiving an event that it can handle, the * listener attempts to delegate the event to one or more event handlers to * process the event (i.e. a Log4JLoggedInEventHandler and a * DbLoggedInEventHandler). * <p> * The following properties are required to be set: * </p> * <ul> * <li>eventHandlers - the list of event handlers that can process events.</li> * </ul> * * @author Scott Battaglia * @version $Revision: 42053 $ $Date: 2007-06-10 09:17:55 -0400 (Sun, 10 Jun 2007) $ * @since 3.0 */public final class EventListener implements ApplicationListener { /** The array of event handlers. */ @NotEmpty private List<EventHandler> eventHandlers; public void onApplicationEvent(final ApplicationEvent applicationEvent) { if (!AbstractEvent.class.isAssignableFrom(applicationEvent.getClass())) { return; } for (final EventHandler eventHandler : this.eventHandlers) { if (eventHandler.supports(applicationEvent)) { eventHandler.handleEvent(applicationEvent); } } } /** * Method to set the Event Handlers to process events. * * @param eventHandlers the handlers. */ public void setEventHandlers(final List<EventHandler> eventHandlers) { this.eventHandlers = eventHandlers; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?