Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2012 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.kuali.rice.core.web.listener;
 import java.util.Map;

Finds and executes listeners in the config file.
 public class BootstrapListener implements HttpSessionListener {
     private static final Logger LOG = Logger.getLogger(BootstrapListener.class);  
     private static final String LISTENER_PREFIX = "listener.";
     private static final String CLASS_SUFFIX = ".class";
     private boolean initted;
     private final Map<StringHttpSessionListenerlisteners = new HashMap<StringHttpSessionListener>();
     private void addListener(String nameString classname) {
         .debug("Adding listener: " + name + "=" + classname);
         Object listenerObject = GlobalResourceLoader.getResourceLoader().getObject(new ObjectDefinition(classname));
         if (listenerObject == null) {
             .error("Listener '" + name + "' class not found: " + classname);
         if (!(listenerObject instanceof HttpSessionListener)) {
             .error("Class '" + listenerObject.getClass() + "' does not implement servlet javax.servlet.http.HttpSessionListener");
         HttpSessionListener listener = (HttpSessionListenerlistenerObject;
     private synchronized void init() {
         if () {
         .debug("Initializing BootstrapListener...");
         Config cfg = ConfigContext.getCurrentContextConfig();
         @SuppressWarnings({ "unchecked""rawtypes" })
         final Map<StringStringproperties = new HashMap<StringString>((Mapcfg.getProperties());
         for (Map.Entry<StringStringentry : properties.entrySet()) {
             String key = entry.getKey().toString();
             if (key.startsWith() && key.endsWith()) {
                 String name = key.substring(.length(), key.length() - .length());
                 String value = entry.getValue();
          = true;
     public void sessionCreated(final HttpSessionEvent event) {
         .debug("Begin BootstrapListener session created...");
         for (HttpSessionListener listener : .values()) {
         .debug("...end BootstrapListener session created.");

    public void sessionDestroyed(final HttpSessionEvent event) {
        .debug("Begin BootstrapListener session destroyed...");
        for (HttpSessionListener listener : .values()) {
        .debug("...end BootstrapListener session destroyed.");
    	return ;
New to GrepCode? Check out our FAQ X