com.itmill.toolkit.terminal.gwt.server
Class WebApplicationContext

java.lang.Object
  extended by com.itmill.toolkit.terminal.gwt.server.WebApplicationContext
All Implemented Interfaces:
ApplicationContext, EventListener, HttpSessionBindingListener
Direct Known Subclasses:
PortletApplicationContext

public class WebApplicationContext
extends Object
implements ApplicationContext, HttpSessionBindingListener

Web application context for the IT Mill Toolkit applications.

Since:
3.1
Version:
5.3.0
Author:
IT Mill Ltd.

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.service.ApplicationContext
ApplicationContext.TransactionListener
 
Field Summary
protected  HashSet applications
           
protected  WebBrowser browser
           
protected  List listeners
           
protected  HttpSession session
           
 
Method Summary
protected  void addApplication(Application application)
           
 void addTransactionListener(ApplicationContext.TransactionListener listener)
          Adds the transaction listener to this context.
protected  void endTransaction(Application application, HttpServletRequest request)
          Notifies the transaction end.
 boolean equals(Object obj)
           
static WebApplicationContext getApplicationContext(HttpSession session)
          Gets the application context for HttpSession.
 Collection getApplications()
          Gets the applications in this context.
 File getBaseDirectory()
          Gets the application context base directory.
 WebBrowser getBrowser()
          Get the web browser associated with this application context.
 HttpSession getHttpSession()
          Gets the http-session application is running in.
 int hashCode()
           
protected  void removeApplication(Application application)
           
 void removeTransactionListener(ApplicationContext.TransactionListener listener)
          Removes the transaction listener from this context.
protected  void startTransaction(Application application, HttpServletRequest request)
          Notifies the transaction start.
 void valueBound(HttpSessionBindingEvent arg0)
           
 void valueUnbound(HttpSessionBindingEvent event)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected List listeners

session

protected HttpSession session

applications

protected final HashSet applications

browser

protected WebBrowser browser
Method Detail

getBaseDirectory

public File getBaseDirectory()
Gets the application context base directory.

Specified by:
getBaseDirectory in interface ApplicationContext
Returns:
The application base directory
See Also:
ApplicationContext.getBaseDirectory()

getHttpSession

public HttpSession getHttpSession()
Gets the http-session application is running in.

Returns:
HttpSession this application context resides in.

getApplications

public Collection getApplications()
Gets the applications in this context.

Specified by:
getApplications in interface ApplicationContext
Returns:
Collection containing all applications in this context
See Also:
ApplicationContext.getApplications()

getApplicationContext

public static WebApplicationContext getApplicationContext(HttpSession session)
Gets the application context for HttpSession.

Parameters:
session - the HTTP session.
Returns:
the application context for HttpSession.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

addTransactionListener

public void addTransactionListener(ApplicationContext.TransactionListener listener)
Adds the transaction listener to this context.

Specified by:
addTransactionListener in interface ApplicationContext
Parameters:
listener - the listener to be added.
See Also:
ApplicationContext.addTransactionListener(com.itmill.toolkit.service.ApplicationContext.TransactionListener)

removeTransactionListener

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

Specified by:
removeTransactionListener in interface ApplicationContext
Parameters:
listener - the listener to be removed.
See Also:
ApplicationContext.removeTransactionListener(com.itmill.toolkit.service.ApplicationContext.TransactionListener)

startTransaction

protected void startTransaction(Application application,
                                HttpServletRequest request)
Notifies the transaction start.

Parameters:
application -
request - the HTTP request.

endTransaction

protected void endTransaction(Application application,
                              HttpServletRequest request)
Notifies the transaction end.

Parameters:
application -
request - the HTTP request.

removeApplication

protected void removeApplication(Application application)

addApplication

protected void addApplication(Application application)

valueBound

public void valueBound(HttpSessionBindingEvent arg0)
Specified by:
valueBound in interface HttpSessionBindingListener
See Also:
HttpSessionBindingListener.valueBound(HttpSessionBindingEvent)

valueUnbound

public void valueUnbound(HttpSessionBindingEvent event)
Specified by:
valueUnbound in interface HttpSessionBindingListener
See Also:
HttpSessionBindingListener.valueUnbound(HttpSessionBindingEvent)

getBrowser

public WebBrowser getBrowser()
Get the web browser associated with this application context. Because application context is related to the http session and server maintains one session per browser-instance, each context has exactly one web browser associated with it.

Returns:


Copyright © 2000-2009 IT Mill Ltd. All Rights Reserved.