com.vaadin.service
Interface ApplicationContext

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractWebApplicationContext, PortletApplicationContext2, WebApplicationContext

public interface ApplicationContext
extends Serializable

ApplicationContext provides information about the running context of the application. Each context is shared by all applications that are open for one user. In a web-environment this corresponds to a HttpSession.

Since:
3.1
Version:
7.0.0.alpha3
Author:
Vaadin Ltd.

Nested Class Summary
static interface ApplicationContext.TransactionListener
          Interface for listening to transaction events.
 
Method Summary
 void addTransactionListener(ApplicationContext.TransactionListener listener)
          Adds a transaction listener to this context.
 String generateApplicationResourceURL(ApplicationResource resource, String urlKey)
          Deprecated. this method is intended for terminal implementation only and is subject to change/removal from the interface (to AbstractCommunicationManager)
 Collection<Application> getApplications()
          Returns a collection of all the applications in this context.
 File getBaseDirectory()
          Returns application context base directory.
 String getURLKey(URL context, String relativeUri)
          Deprecated. this method is intended for terminal implementation only and is subject to change/removal from the interface (to AbstractCommunicationManager)
 boolean isApplicationResourceURL(URL context, String relativeUri)
          Deprecated. this method is intended for terminal implementation only and is subject to change/removal from the interface (to AbstractCommunicationManager)
 void removeTransactionListener(ApplicationContext.TransactionListener listener)
          Removes a transaction listener from this context.
 

Method Detail

getBaseDirectory

File getBaseDirectory()
Returns application context base directory. Typically an application is deployed in a such way that is has an application directory. For web applications this directory is the root directory of the web applications. In some cases applications might not have an application directory (for example web applications running inside a war).

Returns:
The application base directory or null if the application has no base directory.

getApplications

Collection<Application> getApplications()
Returns a collection of all the applications in this context. Each application context contains all active applications for one user.

Returns:
A collection containing all the applications in this context.

addTransactionListener

void addTransactionListener(ApplicationContext.TransactionListener listener)
Adds a transaction listener to this context. The transaction listener is called before and after each each request related to this session except when serving static resources. The transaction listener must not be null.

See Also:
addTransactionListener(com.vaadin.service.ApplicationContext.TransactionListener)

removeTransactionListener

void removeTransactionListener(ApplicationContext.TransactionListener listener)
Removes a transaction listener from this context.

Parameters:
listener - the listener to be removed.
See Also:
ApplicationContext.TransactionListener

generateApplicationResourceURL

@Deprecated
String generateApplicationResourceURL(ApplicationResource resource,
                                                 String urlKey)
Deprecated. this method is intended for terminal implementation only and is subject to change/removal from the interface (to AbstractCommunicationManager)

Generate a URL that can be used as the relative location of e.g. an ApplicationResource. This method should only be called from the processing of a UIDL request, not from a background thread. The return value is null if used outside a suitable request.

Parameters:
resource -
urlKey - a key for the resource that can later be extracted from a URL with getURLKey(URL, String)

isApplicationResourceURL

@Deprecated
boolean isApplicationResourceURL(URL context,
                                            String relativeUri)
Deprecated. this method is intended for terminal implementation only and is subject to change/removal from the interface (to AbstractCommunicationManager)

Tests if a URL is for an application resource (APP/...).

Parameters:
context -
relativeUri -
Returns:

getURLKey

@Deprecated
String getURLKey(URL context,
                            String relativeUri)
Deprecated. this method is intended for terminal implementation only and is subject to change/removal from the interface (to AbstractCommunicationManager)

Gets the identifier (key) from an application resource URL. This key is the one that was given to generateApplicationResourceURL(ApplicationResource, String) when creating the URL.

Parameters:
context -
relativeUri -
Returns:


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