java.lang.Object
org.htmlunit.StorageHolder
- All Implemented Interfaces:
Serializable
Holder for different types of storages.
Experimental API: May be changed in next release!
- Author:
- Ahmed Ashour, Ronald Brill, Marc Guillemot, Vidya m
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcopySessionStorage(WebWindow opener, WebWindow newWindow) Copies the session storage of the opener's origin into the session storage of a newly opened top level window (e.g. by window.open()).getLocalStorage(URL url) Gets the local storage (map).getSessionStorage(WebWindow webWindow) Gets the session storage (map) of the window for the origin of the page currently loaded into the window.getSessionStorage(WebWindow webWindow, URL url) Gets the session storage (map) of the window for the given origin.getStore(StorageHolder.Type storageType, Page page) Gets the store of the give type for the page.
-
Constructor Details
-
StorageHolder
public StorageHolder()
-
-
Method Details
-
getStore
Gets the store of the give type for the page. The local storage is shared by all pages of the same origin; the session storage is shared by all pages of the same origin inside the same top level window. Pages without an origin of their own (e.g. about:blank iframes) are using the origin of their creator.- Parameters:
storageType- the typepage- the page- Returns:
- the store
-
getLocalStorage
Gets the local storage (map).- Parameters:
url- the page origin- Returns:
- the store
-
getSessionStorage
Gets the session storage (map) of the window for the origin of the page currently loaded into the window.If the window has no page with an origin yet (no page or about:blank), a store not bound to an origin is returned; this store is used as session storage for the origin of the first page loaded into this window that accesses the session storage. This allows to pre-populate the session storage before loading the page;
getSessionStorage(WebWindow, URL)is the preferred way to do this.- Parameters:
webWindow- the window- Returns:
- the store
-
getSessionStorage
Gets the session storage (map) of the window for the given origin. The session storage is shared by all windows (including frames) of the same top level window.- Parameters:
webWindow- the windowurl- the origin- Returns:
- the store
-
copySessionStorage
Copies the session storage of the opener's origin into the session storage of a newly opened top level window (e.g. by window.open()). Nothing is copied if the target window already has session storage for this origin.- Parameters:
opener- the window that opened the new onenewWindow- the new window
-