Package com.day.cq.personalization
Class ContextSessionPersistence
- java.lang.Object
-
- com.day.cq.personalization.ContextSessionPersistence
-
public class ContextSessionPersistence extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ContextSessionPersistence()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.String
get(SlingHttpServletRequest request, java.lang.String key)
Returns the value from the default session persistence cookie for the specifiedkey
.static java.lang.String
get(SlingHttpServletRequest request, java.lang.String key, java.lang.String cookieName)
Returns the value from the specifiedcookieName cookie
for the specifiedkey
.static java.lang.String
get(SlingHttpServletRequest request, java.lang.String key, SlingSettingsService settingsService)
Deprecated.since 5.6.static java.lang.String
getCookieName()
Return the name of the default session persistence cookie.static java.lang.String
getCookieName(java.lang.String cookiePrefix, SlingSettingsService settingsService)
Deprecated.since 5.6.static java.lang.String
getCookieName(SlingSettingsService settingsService)
Deprecated.since 5.6.static java.lang.String
getMap(SlingHttpServletRequest request)
Returns a key/value map of the default session persistence cookie.static java.lang.String
getMap(SlingHttpServletRequest request, java.lang.String cookieName)
Returns a key/value map of named cookie.static java.lang.String
getMap(SlingHttpServletRequest request, SlingSettingsService settingsService)
Deprecated.since 5.6.static java.util.Map<java.lang.String,java.lang.String>
getStore(SlingHttpServletRequest request, java.lang.String key)
Return a single store (by its key) from the default session persistence cookie.static java.util.Map<java.lang.String,java.lang.String>
getStore(SlingHttpServletRequest request, java.lang.String key, java.lang.String cookieName)
Return a single store (by its key) from a named cookie.static java.util.Map<java.lang.String,java.lang.String>
getStore(SlingHttpServletRequest request, java.lang.String key, SlingSettingsService settingsService)
Deprecated.since 5.6.static void
put(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.lang.String value)
Add a name/value pair to the default session persistence cookie.static void
put(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.lang.String value, java.lang.String cookieName)
Add a name/value pair to a named cookie.static void
put(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.lang.String value, SlingSettingsService settingsService)
Deprecated.since 5.6.static void
putStore(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> store)
Persists a single store under the given key.static void
putStore(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> store, SlingSettingsService settingsService)
Deprecated.since 5.6.static void
putStores(SlingHttpServletRequest request, SlingHttpServletResponse response, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> stores, java.lang.String cookieName)
Put multiple stores at once without overwriting stores previously put to response.
-
-
-
Method Detail
-
get
public static java.lang.String get(SlingHttpServletRequest request, java.lang.String key, SlingSettingsService settingsService)
Deprecated.since 5.6. Useget(org.apache.sling.api.SlingHttpServletRequest, String)
instead.Returns the value from the default session persistence cookie for the specifiedkey
.- Parameters:
request
- The SlingHttpServletRequestkey
- KeysettingsService
- The SlingSettingsService- Returns:
- Value or an empty string
-
get
public static java.lang.String get(SlingHttpServletRequest request, java.lang.String key)
Returns the value from the default session persistence cookie for the specifiedkey
.- Parameters:
request
- The SlingHttpServletRequestkey
- Key- Returns:
- Value or an empty string
-
get
public static java.lang.String get(SlingHttpServletRequest request, java.lang.String key, java.lang.String cookieName)
Returns the value from the specifiedcookieName cookie
for the specifiedkey
.- Parameters:
request
- The SlingHttpServletRequestkey
- KeycookieName
- Cookie name- Returns:
- Value or an empty string
-
getMap
public static java.lang.String getMap(SlingHttpServletRequest request, SlingSettingsService settingsService)
Deprecated.since 5.6. UsegetMap(org.apache.sling.api.SlingHttpServletRequest)
instead.Returns a key/value map of the default session persistence cookie.- Parameters:
request
- The SlingHttpServletRequestsettingsService
- The SlingSettingsService- Returns:
- Map with key/value pairs
-
getMap
public static java.lang.String getMap(SlingHttpServletRequest request)
Returns a key/value map of the default session persistence cookie.- Parameters:
request
- The SlingHttpServletRequest- Returns:
- Map with key/value pairs
-
getMap
public static java.lang.String getMap(SlingHttpServletRequest request, java.lang.String cookieName)
Returns a key/value map of named cookie.- Parameters:
request
- The SlingHTTPServletRequestcookieName
- Cookie name- Returns:
- Map with key/value pairs
-
put
public static void put(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.lang.String value, SlingSettingsService settingsService)
Deprecated.Add a name/value pair to the default session persistence cookie.- Parameters:
request
- The SlingHTTPServletRequestresponse
- The SlingHTTPServletResponsekey
- Keyvalue
- ValuesettingsService
- The SlingSettingsService
-
put
public static void put(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.lang.String value)
Add a name/value pair to the default session persistence cookie.- Parameters:
request
- The SlingHTTPServletRequestresponse
- The SlingHTTPServletResponsekey
- Keyvalue
- Value
-
put
public static void put(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.lang.String value, java.lang.String cookieName)
Add a name/value pair to a named cookie.- Parameters:
request
- The SlingHTTPServletRequestresponse
- The SlingHTTPServletResponsekey
- Keyvalue
- ValuecookieName
- Cookie name
-
getStore
public static java.util.Map<java.lang.String,java.lang.String> getStore(SlingHttpServletRequest request, java.lang.String key, SlingSettingsService settingsService)
Deprecated.since 5.6. UsegetStore(org.apache.sling.api.SlingHttpServletRequest, String)
instead.Return a single store (by its key) from the default session persistence cookie.- Parameters:
request
- The SlingHTTPServletRequestkey
- Key referencing the storesettingsService
- The SlingSettingsService- Returns:
- the store
-
getStore
public static java.util.Map<java.lang.String,java.lang.String> getStore(SlingHttpServletRequest request, java.lang.String key)
Return a single store (by its key) from the default session persistence cookie.- Parameters:
request
- The SlingHttpServletRequestkey
- Key referencing the store- Returns:
- the store
-
getStore
public static java.util.Map<java.lang.String,java.lang.String> getStore(SlingHttpServletRequest request, java.lang.String key, java.lang.String cookieName)
Return a single store (by its key) from a named cookie.- Parameters:
request
- The SlingHttpServletRequestkey
- Key referencing the storecookieName
- Cookie name- Returns:
- the store
-
putStore
public static void putStore(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> store, SlingSettingsService settingsService)
Deprecated.Persists a single store under the given key.- Parameters:
request
- The SlingHttpServletRequestresponse
- The SlingHttpServletResponsekey
- Keystore
- A map representing the storesettingsService
- The SlingSettingsService
-
putStore
public static void putStore(SlingHttpServletRequest request, SlingHttpServletResponse response, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> store)
Persists a single store under the given key.Note: Don't use this method to persist multiple stores. Use
putStores(SlingHttpServletRequest, SlingHttpServletResponse, Map, String)
instead.- Parameters:
request
- The SlingHttpServletRequestresponse
- The SlingHttpServletResponsekey
- Keystore
- A map representing the store
-
putStores
public static void putStores(SlingHttpServletRequest request, SlingHttpServletResponse response, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> stores, java.lang.String cookieName)
Put multiple stores at once without overwriting stores previously put to response. The method takes a map of stores where the key corresponds to the store key.- Parameters:
request
- The requestresponse
- The responsestores
- The map of storescookieName
- The cookie's name
-
getCookieName
public static java.lang.String getCookieName()
Return the name of the default session persistence cookie.- Returns:
- Cookie name
-
getCookieName
public static java.lang.String getCookieName(SlingSettingsService settingsService)
Deprecated.since 5.6. UsegetCookieName()
instead.Return the name of the cookie.- Parameters:
settingsService
- The SlingSettingsService- Returns:
- Cookie name
-
getCookieName
public static java.lang.String getCookieName(java.lang.String cookiePrefix, SlingSettingsService settingsService)
Deprecated.since 5.6. UsegetCookieName()
instead.Return the name of the cookie.- Parameters:
cookiePrefix
- The cookie prefixsettingsService
- The SlingSettingsService- Returns:
- Cookie name
-
-