Class ServletLibrary

java.lang.Object
name.matthewgreet.strutscommons.util.ServletLibrary

public class ServletLibrary extends Object
Static library functions for servlets.
  • Field Details

  • Constructor Details

    • ServletLibrary

      public ServletLibrary()
  • Method Details

    • getBrowserOldTabId

      public static String getBrowserOldTabId(javax.servlet.http.Cookie[] cookies)
    • getBrowserTabId

      public static String getBrowserTabId(javax.servlet.http.Cookie[] cookies)

      Returns tab id within a browser that, when combined with session, uniquely identifies a browser tab, or null if this information is missing. Web pages making requests must include browserTab2.js for this to work correctly. generateTabId in the same library must have already been called in the tab's lifetime but the script automatically adds this to page loading anyway.

      Popup windows can be problematic if displaying session-based data created by other windows, particularly record list caches. If the popup is created by Javascript window.open, set the popup window name to end with the creator's window top name, such as window.open('', 'historypopup' + window.top.name, 'left=400,top=300'). Don't forget any hyperlinks that refer to the popup window name as its target.

      Parameters:
      cookies - Cookies obtained from HTTP servlet request.
    • getGuaranteedBrowserTabId

      public static String getGuaranteedBrowserTabId(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Returns id that uniquely identifies a browser tab. This requires web pages to use browserTab2.js. See getBrowserTabId(javax.servlet.http.Cookie[]). If the browser hasn't set one, creates one and sets the tab id cookie in the response. If the tab id contains '_popup_', it's from a popup window sharing a tab id with a main page and the tab id is extracted from that.
    • makeSetTabIdCookie

      public static javax.servlet.http.Cookie makeSetTabIdCookie()
      Returns a new cookie to set the browser's tab id.