com.vaadin.server
Class AddonContext

java.lang.Object
  extended by com.vaadin.server.AddonContext
All Implemented Interfaces:
java.io.Serializable

public class AddonContext
extends java.lang.Object
implements java.io.Serializable

Point of entry for add-ons for integrating into various aspects of the framework. One add-on context is initialized for each Vaadin Servlet or Portlet instance and upon initialization, every AddonContextListener that can be found is notified to let it add listeners to the context.

By default, AddonContextListeners are loaded using ServiceLoader, which means that the file META-INF/services/com.vaadin.server.AddonContextListener will be checked for lines containing fully qualified names of classes to use. This behavior can however be overridden for custom deployment situations (e.g. to use CDI or OSGi) by overriding VaadinService.getAddonContextListeners().

Since:
7.0.0
Author:
Vaadin Ltd
See Also:
Serialized Form

Constructor Summary
AddonContext(VaadinService vaadinService)
          Creates a new context using a given vaadin service.
 
Method Summary
 void addBootstrapListener(BootstrapListener listener)
          Shorthand for adding a bootstrap listener that will be added to every new service session.
 void destroy()
          Destroys this context, causing all initialized listeners to be invoked.
 VaadinService getService()
          Gets the vaadin service for this context.
 void init()
          Initializes this context, causing all found listeners to be notified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddonContext

public AddonContext(VaadinService vaadinService)
Creates a new context using a given vaadin service. Only the framework itself should typically create AddonContext instances.

Parameters:
vaadinService - the vaadin service for the associated servlet or portlet.
Method Detail

getService

public VaadinService getService()
Gets the vaadin service for this context.

Returns:
the vaadin service

init

public void init()
Initializes this context, causing all found listeners to be notified. Listeners are by default found using ServiceLoader, but the VaadinService can provide an alternative implementation.

This method is not intended to be used by add-ons, but instead by the part of the framework that created this context object.


destroy

public void destroy()
Destroys this context, causing all initialized listeners to be invoked.

This method is not intended to be used by add-ons, but instead by the part of the framework that created this context object.


addBootstrapListener

public void addBootstrapListener(BootstrapListener listener)
Shorthand for adding a bootstrap listener that will be added to every new service session.

Parameters:
listener - the bootstrap listener that should be added to all new applications.
See Also:
VaadinServiceSession.addBootstrapListener(BootstrapListener)


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.