Interface BrowserTabSession

All Superinterfaces:
javax.servlet.http.HttpSession
All Known Implementing Classes:
BrowserTabSessionImpl

public interface BrowserTabSession extends javax.servlet.http.HttpSession

Like HttpSession, stores sets of named data or attribute about a user between requests but data are private to each browser tab, so different pages of the same browser don't clash when using the same name. Instances are injected into Actions implementing BrowserTabAware2 by the BrowserTabInterceptor2 interceptor.

User data, such as authentication, can be shared. When an attribute, identified by its name, is read, it can come from a tab's private set or the shared set but not both. The normal set function, setAttribute, sets a private attribute (unless it's already shared) whereas setSharedAttribute sets it as shared (also deleting private attributes using the same name). Actions of the same application are expected to know shared attribute names.

Implementations are wrappers around the request's session and shared attribute are stored in it, so such attributes can be accessed by code that don't recognise this class.

  • Method Details

    • getAllTabIds

      Set<String> getAllTabIds()
      Returns ids of all browser tabs known to exist for the user.
    • getAttribute

      Object getAttribute(String name)
      Returns object bound to name, whether as private or shared attribute, or null if none.
      Specified by:
      getAttribute in interface javax.servlet.http.HttpSession
    • getAttributeMap

      Map<String,Object> getAttributeMap()
      Returns shallow copy of all attributes, whether private or shared. Changing the map won't affect the session.
    • getAttributeNames

      Enumeration<String> getAttributeNames()
      Returns an enumeration of all attribute names, whether private or shared.
      Specified by:
      getAttributeNames in interface javax.servlet.http.HttpSession
    • getHttpSession

      javax.servlet.http.HttpSession getHttpSession()
      Returns underlying request session.
    • getPrivateAttributeMap

      Map<String,Object> getPrivateAttributeMap()
      Returns shallow copy of private, tab-specific attributes. Changing the map won't affect the session.
    • getPrivateAttributeNames

      Set<String> getPrivateAttributeNames()
      Returns set of names of private, tab-specific attributes.
    • getSharedAttributeMap

      Map<String,Object> getSharedAttributeMap()
      Returns shallow copy of shared attributes. Changing the map won't affect the session.
    • getSharedAttributeNames

      Set<String> getSharedAttributeNames()
      Returns set of names of shared attributes.
    • getTabId

      String getTabId()
      Returns id of browser tab.
    • setAttribute

      void setAttribute(String name, Object value)
      Binds an object to a name as a private, tab-specific attribute, replacing any existing value. If the attribute already exists and is shared, the attribute remains shared.
      Specified by:
      setAttribute in interface javax.servlet.http.HttpSession
    • setSharedAttribute

      void setSharedAttribute(String name, Object value)
      Like setAttribute(java.lang.String, java.lang.Object), binds an object to a name but as a shared attribute. If any private attributes have the same name, they're removed.