Class GenericBrowserSettings
- java.lang.Object
-
- com.microstrategy.web.app.GenericBrowserSettings
-
- All Implemented Interfaces:
BrowserSettings
,EnumBrowserType
- Direct Known Subclasses:
AbstractBrowserSettings
,HttpBrowserSettings
public abstract class GenericBrowserSettings extends java.lang.Object implements BrowserSettings
This abstract class represents a generic implementation of the BrowserSettings interface.It provides with implementation of methods that can be used on other BrowserSettings child classes. Some of these methods are the ones that provide a cache system for the values (
addCacheValue()
,getCacheValue()
, etc); others for values related to the Query String and Form Data (buildBrowserSettingURLParameter()
,getValueFromQueryString()
, etc); and generic methods for finding out information about the client browser that made a request (isDHTMLSupported()
,getBrowserType()
, etc)As mentioned above, this implementation provides a cache system that can be used transparently by the classes that extend this implementation. It is assumed that the values saved under the main keys are with URL-like format, for example:
key1=subkey1=value1&subkey2=value2
This formatting is completely hidden if using the cache methods. If the cache does not exist then the updateCacheValue() method can be directly used and this one will create the cache and will provide the URL-like string required to be saved as the value of a cookie, a preference, or any other.- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Field Summary
Fields Modifier and Type Field Description protected ContainerServices
_containerServices
Instance ofContainerServices
to be used for accessing the values of Form, Query String and cookiesprotected WebIServerSession
_session
Instance ofWebIServerSession
related with the BrowserSettings currently processedprotected static java.lang.String
GENERIC_HTTP_SESSION_KEY
Primary key to use for representing global temporal browser setting valuesprotected static java.lang.String
GENERIC_KEY
Primary key to use for representing global persistent browser setting valuesprotected static java.lang.String
GENERIC_PROJECT_KEY_PREFIX
key name prefix for project settings *-
Fields inherited from interface com.microstrategy.web.objects.EnumBrowserType
BROWSER_TYPE_ANDROID, BROWSER_TYPE_CHROME, BROWSER_TYPE_EDGE, BROWSER_TYPE_FIREFOX, BROWSER_TYPE_FIREFOX_2, BROWSER_TYPE_FIREFOX_3, BROWSER_TYPE_FIREFOX_3_5, BROWSER_TYPE_IE, BROWSER_TYPE_IE_W3C, BROWSER_TYPE_IE10, BROWSER_TYPE_IE11, BROWSER_TYPE_IE6, BROWSER_TYPE_IE7, BROWSER_TYPE_IE8, BROWSER_TYPE_IE9, BROWSER_TYPE_NETSCAPE, BROWSER_TYPE_OTHER, BROWSER_TYPE_SAFARI, BROWSER_TYPE_UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description GenericBrowserSettings()
Class Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addCacheValue(java.lang.String key, java.lang.String value)
Deprecated.it is only used by deprecated classes.protected void
addCacheValue(java.lang.String key, java.lang.String value, boolean persistable)
Deprecated.it is only used by deprecated classes.java.lang.String
getBrowserCompatName()
Returns the name of the IE browser including its status to indicate whether it is requesitng in Compatibility Mode.java.lang.String
getBrowserName()
Returns the name of the browser that is being used for performing the requestint
getBrowserType()
Returns the type of the browser that is being used for performing the request being handled.int
getBrowserTypeAndVersion()
Returns the type and the version of the browserjava.lang.String
getBrowserVersion()
Returns the numeric version of the browser that is being used.protected java.util.Enumeration
getCacheNames()
Deprecated.it is only used by deprecated classes.protected java.lang.String
getCacheValue(java.lang.String key)
Deprecated.it is only used by deprecated classes.protected java.lang.String
getCacheValue(java.lang.String key, java.lang.String subkey)
Deprecated.it is only used by deprecated classes.MarkupOutput
getDebugOut()
Get the Debug Information into the outputjava.lang.String
getDefaultValue(java.lang.String key)
Return the default value of a specific setting.BrowserSettingDefinitionList
getDefinitionList()
Return the default definition of the browser setting which will be use to determine the value of the browser settings in case the setting requested is not found for the user.java.lang.String
getLocale()
Get the locale value saved as browser settingPreferences
getPreferences()
Get the Preferences instance currently assigned to this BrowserSettingsWebIServerSession
getSession()
Gets the session that is used as default when accessing session settings.java.lang.String
getUserAgent()
Retrives the USER-AGENT string from the header of the browser.protected java.lang.String
getValueFromQueryString(java.lang.String keyName, java.lang.String subKeyName)
Deprecated.it is only used by deprecated classes.boolean
hasValueSet(java.lang.String keyName)
Checks whether a value has been set for the given key name or notprotected boolean
isCacheValueModified(java.lang.String key)
Deprecated.it is only used by deprecated classes.protected boolean
isCacheValuePersistable(java.lang.String key)
Deprecated.it is only used by deprecated classes.boolean
isCSS2Supported()
Indicates if the browser currently used by the client can handle CSS 2 styles.boolean
isDHTMLSupported()
Indicates if the browser currently used by the client can handle DHTML content or not.boolean
isEdgeModeEnabled()
Get flag whether System Preference enables a tag to force IE browsers to render in highest Document Mode.protected boolean
isValueCached(java.lang.String key)
Deprecated.it is only used by deprecated classes.protected boolean
isValueSafeForXSS(java.lang.String key, java.lang.String value)
Check if the value is safe for XSS, which means check the value contains valid HTML tag or notprotected void
setCacheValuePersistable(java.lang.String key, boolean persistable)
Deprecated.it is only used by deprecated classes.void
setDefinitionList(BrowserSettingDefinitionList bsDefinitionList)
Sets the default definition of the browser setting.void
setIframeVisibility(java.lang.String value)
Define a browser setting for allowing the IFrame to be shown on DHTML environments.void
setPreferences(Preferences preferences)
Set the Preferences instance to use for this BrowserSettings instancevoid
setSession(WebIServerSession currentSession)
Sets the session that will be used as default when accessing session settings.protected java.lang.String
updateCacheValue(java.lang.String key, java.lang.String subkey, java.lang.String newValue)
Deprecated.it is only used by deprecated classes.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.microstrategy.web.app.BrowserSettings
clearHttpSessionValues, clearSessionBrowserSettings, clearSessionValues, clearSessionValues, flush, getHttpSessionValue, getSessionValue, getSessionValue, getValue, setHttpSessionValue, setSessionValue, setSessionValue, setValue
-
-
-
-
Field Detail
-
GENERIC_KEY
protected static final java.lang.String GENERIC_KEY
Primary key to use for representing global persistent browser setting values- See Also:
- Constant Field Values
-
GENERIC_HTTP_SESSION_KEY
protected static final java.lang.String GENERIC_HTTP_SESSION_KEY
Primary key to use for representing global temporal browser setting values- See Also:
- Constant Field Values
-
GENERIC_PROJECT_KEY_PREFIX
protected static final java.lang.String GENERIC_PROJECT_KEY_PREFIX
key name prefix for project settings *- Since:
- MicroStrategy Web 8.0.2
- See Also:
- Constant Field Values
-
_containerServices
protected ContainerServices _containerServices
Instance ofContainerServices
to be used for accessing the values of Form, Query String and cookies
-
_session
protected WebIServerSession _session
Instance ofWebIServerSession
related with the BrowserSettings currently processed
-
-
Method Detail
-
setPreferences
public void setPreferences(Preferences preferences)
Set the Preferences instance to use for this BrowserSettings instance- Specified by:
setPreferences
in interfaceBrowserSettings
- Parameters:
preferences
- a validPreferences
instance
-
getPreferences
public Preferences getPreferences()
Get the Preferences instance currently assigned to this BrowserSettings- Specified by:
getPreferences
in interfaceBrowserSettings
- Returns:
- a
Preferences
instance
-
setSession
public void setSession(WebIServerSession currentSession)
Sets the session that will be used as default when accessing session settings.- Specified by:
setSession
in interfaceBrowserSettings
- Parameters:
currentSession
- an initializedWebIServerSession
instance that represents the current session opened.
-
getSession
public WebIServerSession getSession()
Gets the session that is used as default when accessing session settings.- Specified by:
getSession
in interfaceBrowserSettings
- Returns:
- currentSession an initialized
WebIServerSession
instance that represents the current session opened.
-
getBrowserType
public int getBrowserType()
Returns the type of the browser that is being used for performing the request being handled.- Specified by:
getBrowserType
in interfaceBrowserSettings
- Returns:
- an
int
value depending on the type of browser used by the client:BROWSER_TYPE_NETSCAPE
BROWSER_TYPE_IE
BROWSER_TYPE_OTHER
-
getBrowserTypeAndVersion
public int getBrowserTypeAndVersion()
Returns the type and the version of the browser- Specified by:
getBrowserTypeAndVersion
in interfaceBrowserSettings
- Returns:
- an
int
value depending on the type of browser defined inBrowserSettings
. - Since:
- MicroStrategy Web 9.0.1
-
getBrowserVersion
public java.lang.String getBrowserVersion()
Returns the numeric version of the browser that is being used. ie. 1.5, 6, 7- Specified by:
getBrowserVersion
in interfaceBrowserSettings
- Since:
- MicroStrategy Web 9.0.0
-
isCSS2Supported
public boolean isCSS2Supported()
Indicates if the browser currently used by the client can handle CSS 2 styles.- Specified by:
isCSS2Supported
in interfaceBrowserSettings
- Returns:
- a
boolean
value indicating if the client browser can display and handle CSS 2 styles.
-
getUserAgent
public java.lang.String getUserAgent()
Retrives the USER-AGENT string from the header of the browser.- Specified by:
getUserAgent
in interfaceBrowserSettings
- Returns:
- a
String
value indicating USER-AGENT string from the header of the browser - Since:
- MicroStrategy Web 8.0.0
-
isDHTMLSupported
public boolean isDHTMLSupported()
Indicates if the browser currently used by the client can handle DHTML content or not.- Specified by:
isDHTMLSupported
in interfaceBrowserSettings
- Returns:
- a
boolean
value indicating if the client browser can display and handle DHTML code.
-
getLocale
public java.lang.String getLocale()
Get the locale value saved as browser setting- Specified by:
getLocale
in interfaceBrowserSettings
- Returns:
- the localeId available for this BrowserSettings instance.
-
setDefinitionList
public void setDefinitionList(BrowserSettingDefinitionList bsDefinitionList)
Sets the default definition of the browser setting. This definition object will be use to determine the value of the browser settings in case the setting requested is not found for the user.- Specified by:
setDefinitionList
in interfaceBrowserSettings
- Parameters:
bsDefinitionList
- the default definition of the browser settings
-
getDefinitionList
public BrowserSettingDefinitionList getDefinitionList()
Description copied from interface:BrowserSettings
Return the default definition of the browser setting which will be use to determine the value of the browser settings in case the setting requested is not found for the user.- Specified by:
getDefinitionList
in interfaceBrowserSettings
- Returns:
- the default definition of the browser setting. This definition object will be use to determine the value of the browser settings in case the setting requested is not found for the user.
-
getDefaultValue
public java.lang.String getDefaultValue(java.lang.String key)
Return the default value of a specific setting. Returns an null if the definition of the setting was not found on the definition list.- Specified by:
getDefaultValue
in interfaceBrowserSettings
- Parameters:
key
- the name of the browser setting.- Returns:
- the default value of a specific setting
-
hasValueSet
public boolean hasValueSet(java.lang.String keyName)
Description copied from interface:BrowserSettings
Checks whether a value has been set for the given key name or not- Specified by:
hasValueSet
in interfaceBrowserSettings
- Parameters:
keyName
- the name associated with the setting- Returns:
- true if there is a value been set already (other than the default)
- Since:
- MicroStrategy Web 9.0.0
-
getCacheValue
@Deprecated protected java.lang.String getCacheValue(java.lang.String key, java.lang.String subkey)
Deprecated.it is only used by deprecated classes.Obtains the value of the given key-subkey pair if stored on the cache.- Parameters:
key
- Key to search for in the cachesubkey
- Subkey to search for in the cache contents- Returns:
- The value associated with the key-subkey sent. If no value found, returns null.
-
getCacheValue
@Deprecated protected java.lang.String getCacheValue(java.lang.String key)
Deprecated.it is only used by deprecated classes.Obtains the value of the given key if stored on the cache- Parameters:
key
- Key to search for in the cache- Returns:
- The value associated with the key sent. If no value found, returns null.
-
isCacheValuePersistable
@Deprecated protected boolean isCacheValuePersistable(java.lang.String key)
Deprecated.it is only used by deprecated classes.Determines if the cache value related with the key given is a persistable browser setting or not- Parameters:
key
- Key to search for in the cache- Returns:
True
if the cache value is related to a persistent browser setting. Otherwise (or if not found) returnsFalse
-
setCacheValuePersistable
@Deprecated protected void setCacheValuePersistable(java.lang.String key, boolean persistable)
Deprecated.it is only used by deprecated classes.Sets if the cache value related with the key given is a persistable browser setting or not. If the value is not found, nothing is done.- Parameters:
key
- Key to search for in the cachepersistable
-True
if the cache value will be related to a persistent browser setting. Otherwise,False
-
isCacheValueModified
@Deprecated protected boolean isCacheValueModified(java.lang.String key)
Deprecated.it is only used by deprecated classes.Determines if the cache value has been modified since it was initially loaded.- Parameters:
key
- Key to search for in the cache- Returns:
True
if the value has been modified from its original value. Otherwise (or if value is not found) returnsFalse
-
isValueCached
@Deprecated protected boolean isValueCached(java.lang.String key)
Deprecated.it is only used by deprecated classes.Determines if the key sent as parameter is already contained in the cache or not- Parameters:
key
- key to search for in the cache- Returns:
True
if the value is contained in the cache, otherwise returnsFalse
-
getCacheNames
@Deprecated protected java.util.Enumeration getCacheNames()
Deprecated.it is only used by deprecated classes.Return an enumeration of all the keys used in the cache.- Returns:
- an
Enumeration
with all the key names saved in the cache
-
addCacheValue
@Deprecated protected void addCacheValue(java.lang.String key, java.lang.String value)
Deprecated.it is only used by deprecated classes.Adds the indicated value under the given key on the cache. By default it will be considered that the browser setting related is temporal.- Parameters:
key
- Key to use for the value to storevalue
- Value to save in the cache.
-
addCacheValue
@Deprecated protected void addCacheValue(java.lang.String key, java.lang.String value, boolean persistable)
Deprecated.it is only used by deprecated classes.Adds the indicated value under the given key on the cache.- Parameters:
key
- Key to use for the value to storevalue
- Value to save in the cache.persistable
- indicates if the browser setting is temporal or permanent
-
isValueSafeForXSS
protected boolean isValueSafeForXSS(java.lang.String key, java.lang.String value)
Check if the value is safe for XSS, which means check the value contains valid HTML tag or not- Parameters:
key
- Key to use for the valuevalue
- Value to be checked- Returns:
- If the value safe for XSS or not
-
updateCacheValue
@Deprecated protected java.lang.String updateCacheValue(java.lang.String key, java.lang.String subkey, java.lang.String newValue)
Deprecated.it is only used by deprecated classes.Update the value under the given key-subkey combination on the cache- Parameters:
key
- key to search for in the cachesubkey
- subkey to search for in the cache valuenewValue
- new value that the key-subkey combination will have- Returns:
- the full String of the cache value saved under the key (includes all subkeys information)
-
getValueFromQueryString
@Deprecated protected java.lang.String getValueFromQueryString(java.lang.String keyName, java.lang.String subKeyName)
Deprecated.it is only used by deprecated classes.Based on the key and subkey given, search this value on the URL and on the Form Data- Parameters:
keyName
- key to look forsubKeyName
- subkey to look for- Returns:
- the value corresponding to the key-subkey pair sent. If no value is found,
null
is returned.
-
getDebugOut
public MarkupOutput getDebugOut()
Description copied from interface:BrowserSettings
Get the Debug Information into the output- Specified by:
getDebugOut
in interfaceBrowserSettings
- Returns:
- an instance of
MarkupOutput
.
-
setIframeVisibility
public void setIframeVisibility(java.lang.String value)
Define a browser setting for allowing the IFrame to be shown on DHTML environments. A request for hidding the IFrame has precedence over one for showing it.- Specified by:
setIframeVisibility
in interfaceBrowserSettings
- Parameters:
value
- String value of a boolean indicating if the IFrame should be shown.- Since:
- MicroStrategy Web 8.0.0
-
getBrowserName
public java.lang.String getBrowserName()
Description copied from interface:BrowserSettings
Returns the name of the browser that is being used for performing the request- Specified by:
getBrowserName
in interfaceBrowserSettings
- Returns:
- a value depending on the type and version of browser used by the client. supported browser names: ie7, ie8, ie9, ie10, firefox, chrome, safari; otherwise: unsupported-browser.
-
getBrowserCompatName
public java.lang.String getBrowserCompatName()
Description copied from interface:BrowserSettings
Returns the name of the IE browser including its status to indicate whether it is requesitng in Compatibility Mode.- Specified by:
getBrowserCompatName
in interfaceBrowserSettings
- Returns:
- a value depending on the type and version of browser used by the client. supported browser compat names: ie8c, ie9c, ie10c otherwise: ""
-
isEdgeModeEnabled
public boolean isEdgeModeEnabled()
Get flag whether System Preference enables a tag to force IE browsers to render in highest Document Mode.- Specified by:
isEdgeModeEnabled
in interfaceBrowserSettings
- Returns:
- boolean
-
-