ro.isdc.wro.http
Class WroServletContextListener

java.lang.Object
  extended by ro.isdc.wro.http.WroServletContextListener
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

public class WroServletContextListener
extends Object
implements javax.servlet.ServletContextListener

A listener which loads wroConfiguration and stores it in servletContext. If you want to have multiple listeners, extend this class and override the getListenerName() to provide a unique non-empty name (defaulted to "default").

Since:
1.4.6
Author:
Alex Objelean

Constructor Summary
WroServletContextListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
          
 void contextInitialized(javax.servlet.ServletContextEvent event)
          
protected  String getListenerName()
           
protected  WroConfiguration newConfiguration()
          Create the ContextLoader to use.
protected  WroManagerFactory newManagerFactory()
           
 void setConfiguration(WroConfiguration configuration)
          Set the configuration to be initialized by this listener.
 void setManagerFactory(WroManagerFactory managerFactory)
          Set the manager factory to be initialized by this listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WroServletContextListener

public WroServletContextListener()
Method Detail

contextInitialized

public final void contextInitialized(javax.servlet.ServletContextEvent event)

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

newConfiguration

protected WroConfiguration newConfiguration()
Create the ContextLoader to use. Can be overridden in subclasses.

Returns:
the new ContextLoader

newManagerFactory

protected WroManagerFactory newManagerFactory()
Returns:
default implementation of WroManagerFactory.

contextDestroyed

public final void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

setManagerFactory

public final void setManagerFactory(WroManagerFactory managerFactory)
Set the manager factory to be initialized by this listener.

Parameters:
managerFactory - a not null manager instance.

getListenerName

protected String getListenerName()
Returns:
the name of the listener. Override it to provide a different name if you need to configure multiple listener.

setConfiguration

public final void setConfiguration(WroConfiguration configuration)
Set the configuration to be initialized by this listener.

Parameters:
configuration - a not null configuration instance.


Copyright © 2008-2013. All Rights Reserved.