public class

AppContextImpl

extends BeanContextImpl
implements AppContext
java.lang.Object
   ↳ com.microstrategy.web.beans.BeanContextImpl
     ↳ com.microstrategy.web.app.beans.AppContextImpl

Class Overview

This class implements the AppContext. The AppContext includes the objects that the microstrategy application expects to pass information between the different components. It saves an instance of specific applications objects, such as the SessionManager, the Preferences and the RequestKeys.

Summary

[Expand]
Inherited Constants
From interface com.microstrategy.web.app.beans.AppContext
[Expand]
Inherited Fields
From class com.microstrategy.web.beans.BeanContextImpl
Public Constructors
AppContextImpl()
Constructor.
Public Methods
void dispenseFile(String realPath, String resourcePath)
If the file does not exist, a duplicate is made from the specified resource.
WebAppSessionManager getAppSessionManager()
This method returns the Application Session Manager associated with this application context.
String getBrowserHeaderLocaleId(Locale defaultLocale)
This method will extract from request header a value corresponding to browser's locale info.
String getBrowserHeaderLocaleId()
This method will extract from request header a value corresponding to browser's locale info.
String getBrowserLocaleId()
This method returns the Locale Id defined in web preferences as Language.
String getBrowserServerLocaleId()
This method returns the Locale associated with Date and Number format locale web preference.If default, it'll return browser's locale Id instead.
BrowserSettings getBrowserSettings()
This method returns the BrowserSettings instance associated with this application context.
String getConfigParameter(String param)
Returns the value of the configuration parameter
String getConfigServletPath()
Get the full application path to the Servlet as defined in the configuration file
ContainerServices getContainerServices()
This method gets the Container Services object associated with this application context.
ContextMenuManager getContextMenuManager(String contextMenuName)
Returns an instance of a ContextMenuManager object.
PageComponent getCurrentPage()
Returns the name of the current page associated with the context.
Document getDocumentFromFileResource(String filePath)
This method returns a DOM Document from a file resource.
ExternalSecurity getExternalSecurity()
This method returns the External Security instance associated with this application context.
String getFileContentsAsString(String filePath, String encoding)
Returns the contents of the resource file as string from the file path provided using the named character encoding.
String getFileContentsAsString(String filePath)
Returns the contents of the resource file as string from the file path provided.
String getFontName()
Returns a string with the name of the fonts, or the list of fonts that a browser should use when rendering the page.
String getFontSize()
A string with the base font size to use, the string might contain the type of size (i.e, pt, px, etc.)
Messages getMessages()
Returns the Messages instance from this BeanContext.
PageManager getPageManager()
This method gets the PageManager object associated with this application context.
Preferences getPreferences()
Returns the Preferences object associated with this application context.
String getRealPath(String filePath)
Return the absolute path of the relative path provided
String getResourceFileAsString(String filePath, String resourceFileName)
Returns the contents of the resource file as string from the file path provided.
String getResourcesFolder(String folderType)
Return the path to the resources folder indicated on the configuration file, corresponding to the type sent as parameter.
String getRootName()
Returns the name of the root component In the case of the jsp/servlet enviroment,it will be the name of the main servlet component This corresponds to the value of the parameter CONFIG_SERVLET_NAME
String getServletPath()
Get the full application path to the Servlet.
SessionManager getSessionManager()
This method is deprecated. Use WebAppSessionManager instead, via the getAppSessionManager method.
boolean isDoubleByte()
Returns true if the locale is a double byte language like Chinese, Korean or Japenese.
void putConfigParameter(String key, String value)
Appends a configuration parameter to the collection
void setAppSessionManager(WebAppSessionManager sm)
This method sets the Application Session Manager associated with this application context.
void setBrowserSettings(BrowserSettings bs)
This method sets the BrowserSettings object to be associated with this application context.
void setConfigServletPath(String configServletPath)
Define the full application path to the Servlet as defined in the configuration file.
void setContainerServices(ContainerServices cs)
This method sets the Container Services object associated with this application context.
void setCurrentPage(PageComponent page)
Set a page as the current page of this context.
void setDefaultEvent(int eventID)
This method will first check if the config parameter for default event is not present.
void setExternalSecurity(ExternalSecurity es)
This method sets the External Security associated with this application context.
void setMessages(Messages userMsgs)
Sets a Messages instance to this BeanContext.
void setPageManager(PageManager pageManager)
This method sets the PageManager object associated with this application context.
void setPreferences(Preferences preferences)
Sets the Preferences object associated with this application context.
void setServletPath(String servletPath)
Define the full application path to the Servlet.
void setSessionManager(SessionManager sessionManager)
This method is deprecated. Use WebAppSessionManager instead, via the getAppSessionManager method.
Protected Methods
String getEventHandlersCatalogPath()
Returns the path to use for the EventHandlersCatalog file.
String getMessagesManagerPath()
Returns the path to use for the MessagesManager (locales) file.
String getPageManagerPath()
Returns the path to use for the PageManager file.
String getStyleCatalogPath()
Returns the path to use for the StyleCatalog file.
[Expand]
Inherited Methods
From class com.microstrategy.web.beans.BeanContextImpl
From class java.lang.Object
From interface com.microstrategy.web.app.beans.AppContext
From interface com.microstrategy.web.beans.BeanContext

Public Constructors

public AppContextImpl ()

Constructor.

Public Methods

public void dispenseFile (String realPath, String resourcePath)

If the file does not exist, a duplicate is made from the specified resource. This method is used to generate user customizable files from resource templates. Its also a means of creating file system accessible files when the application is deployed as an unexpanded WAR (i.e. configuration files cannot be easily modified).

Parameters
realPath Actual location of the file.
resourcePath Location of the master copy resource.
Throws
IllegalArgumentException Thrown if either the file or resource path is empty.
MSTRUncheckedException Thrown if the resource could not be located, or if an error occurs during duplication.

public WebAppSessionManager getAppSessionManager ()

This method returns the Application Session Manager associated with this application context. If not explicitly set through the setAppSessionManager(WebAppSessionManager) method, a new one is automatically created.
Note that this method fully replaces the getSessionManager method.

Returns

public String getBrowserHeaderLocaleId (Locale defaultLocale)

This method will extract from request header a value corresponding to browser's locale info. This info will be resolved in order to return current browser's LCID. This is equivalent to findBestSupportedLocale(Locale, Locale[]) with available display locales from getAvailableLocales(int) for TYPE_WEB_SUPPORTED.

Returns
  • a String with the LCID

public String getBrowserHeaderLocaleId ()

This method will extract from request header a value corresponding to browser's locale info. This info will be resolved in order to return current browser's locale id.

Returns
  • a String with the Locale ID.

public String getBrowserLocaleId ()

This method returns the Locale Id defined in web preferences as Language. If default, it'll return browser's locale Id instead.

Returns
  • a String with the Locale ID.

public String getBrowserServerLocaleId ()

This method returns the Locale associated with Date and Number format locale web preference.If default, it'll return browser's locale Id instead.

Returns
  • a String with the Locale ID.

public BrowserSettings getBrowserSettings ()

This method returns the BrowserSettings instance associated with this application context.

Returns

public String getConfigParameter (String param)

Returns the value of the configuration parameter

Parameters
param name of the parameter to retrieve
Returns
  • the value of the parameter

public String getConfigServletPath ()

Get the full application path to the Servlet as defined in the configuration file

Returns
  • a String with the servlet path

public ContainerServices getContainerServices ()

This method gets the Container Services object associated with this application context.

public ContextMenuManager getContextMenuManager (String contextMenuName)

Returns an instance of a ContextMenuManager object. Referenced ny name

Parameters
contextMenuName name of the ContextMenuManager object to retrieve
Returns

public PageComponent getCurrentPage ()

Returns the name of the current page associated with the context. It returns null if there no current page.

Returns

public Document getDocumentFromFileResource (String filePath)

This method returns a DOM Document from a file resource. The method works by attempting the following operations, in order:

  1. Try to call the same method on BeanContext first. If that succeeds, return.
  2. Next, it tries to get the real path to this file relative to the web application. If it retrieves a valid path, it again calls the BeanContext's version of this method. If it succeeds, it returns.
  3. At this point, we cannot resolve the reference as a physical file. We then try to use the ServletContext's getResourceAsInput method to retrieve the contents of the file as resource that may be embedded within a WAR file. If this succeeeds, we load the contents into a DOM document and return it.THIS IS ONLY POSSIBLE WITHIN A JAVA ENVIRONMENT.
  4. If we get to this step, then we return an Exception.

Parameters
filePath The absolute or relative path to the file resource.
Returns
  • the Document node that contains the file contents.

public ExternalSecurity getExternalSecurity ()

This method returns the External Security instance associated with this application context.

public String getFileContentsAsString (String filePath, String encoding)

Returns the contents of the resource file as string from the file path provided using the named character encoding. it does not dispense the file

Parameters
filePath location of the resource file (relative path)
encoding The name of a supported character encoding.
Returns
  • the contents of the resource file.

public String getFileContentsAsString (String filePath)

Returns the contents of the resource file as string from the file path provided. it does not dispense the file

Parameters
filePath location of the resource file (relative path)
Returns
  • the contents of the resource file.

public String getFontName ()

Returns a string with the name of the fonts, or the list of fonts that a browser should use when rendering the page. This is usually retrieved from user Preferences

Returns
  • a String with a comma separated list of the fonts to use in this page.

public String getFontSize ()

A string with the base font size to use, the string might contain the type of size (i.e, pt, px, etc.)

Returns
  • a string with size of the font to use

public Messages getMessages ()

Returns the Messages instance from this BeanContext. This method does not contact the MessagesManager object associated with this BeanContext.

Returns
  • the Messages instance.

public PageManager getPageManager ()

This method gets the PageManager object associated with this application context. If no PageManager has been explicitly associated, it will automatically used the one specified by the configuration parameters of the ContainerServices.

Returns
  • the PageManager object associated with this application context.

public Preferences getPreferences ()

Returns the Preferences object associated with this application context. The Preferences mantains the current settings of the application at different levels.

Returns
  • the Preferences object associated with this application context.

public String getRealPath (String filePath)

Return the absolute path of the relative path provided

Parameters
filePath relative path to get the relative path from
Returns
  • the absolute path

public String getResourceFileAsString (String filePath, String resourceFileName)

Returns the contents of the resource file as string from the file path provided. If the resource cannot be found in the location, it will be dispensed

Parameters
filePath location of the resource file
resourceFileName resource file
Returns
  • the contents of the resource file.

public String getResourcesFolder (String folderType)

Return the path to the resources folder indicated on the configuration file, corresponding to the type sent as parameter.
This is actually a convenience method for the getConfigParameter. This method returns all configuration parameters that starts with RESOURCE_FOLDER_PREFIX and folderType is whatever goes after that. This method also makes sure that the name of the folder has always a backslash "/" at the end.

Parameters
folderType integer constant that specifies the type of resource folder to return
Returns
  • the path of the base folder for the folder type requested

public String getRootName ()

Returns the name of the root component In the case of the jsp/servlet enviroment,it will be the name of the main servlet component This corresponds to the value of the parameter CONFIG_SERVLET_NAME

public String getServletPath ()

Get the full application path to the Servlet. This value is read form the configuration file and if is not set it will be automatically generated from the request.

Returns
  • a String with the servlet path

public SessionManager getSessionManager ()

This method is deprecated.
Use WebAppSessionManager instead, via the getAppSessionManager method.

Returns the SessionManager object associated with this application context. The SessionManager manages the different sessions to the Intelligence Server.

Returns

public boolean isDoubleByte ()

Returns true if the locale is a double byte language like Chinese, Korean or Japenese.

Returns
  • true if the locale is a double byte language like Chinese, Korean or Japenese.

public void putConfigParameter (String key, String value)

Appends a configuration parameter to the collection

Parameters
key name of the configuration parameter
value value of the configuration parameter

public void setAppSessionManager (WebAppSessionManager sm)

This method sets the Application Session Manager associated with this application context.

public void setBrowserSettings (BrowserSettings bs)

This method sets the BrowserSettings object to be associated with this application context.

Parameters
bs An instance of an BrowserSettings object.

public void setConfigServletPath (String configServletPath)

Define the full application path to the Servlet as defined in the configuration file.

Parameters
configServletPath a String with the servlet path

public void setContainerServices (ContainerServices cs)

This method sets the Container Services object associated with this application context.

Parameters
cs A ContainerServices object.

public void setCurrentPage (PageComponent page)

Set a page as the current page of this context.

Parameters
page PageComponent instance.

public void setDefaultEvent (int eventID)

This method will first check if the config parameter for default event is not present. If it is present then this method will not do anything. If the config paramter is not present, then this method will set the value of the config parameter with the @param eventID.

Parameters
eventID identifier of the event to become default if not specified on the configuration parameters.

public void setExternalSecurity (ExternalSecurity es)

This method sets the External Security associated with this application context.

Parameters
es An ExternalSecurity instance.

public void setMessages (Messages userMsgs)

Sets a Messages instance to this BeanContext. This method does not contact the MessagesManager object associated with this BeanContext.

Parameters
userMsgs the Messages instance to set.

public void setPageManager (PageManager pageManager)

This method sets the PageManager object associated with this application context.

Parameters
pageManager A PageManager object.

public void setPreferences (Preferences preferences)

Sets the Preferences object associated with this application context. The Preferences mantains the current settings of the application at different levels.

Parameters
preferences the Preferences object associated with this application context.

public void setServletPath (String servletPath)

Define the full application path to the Servlet. This value is read form the configuration file and if is not set it will be automatically generated from the request.

Parameters
servletPath a String with the servlet path

public void setSessionManager (SessionManager sessionManager)

This method is deprecated.
Use WebAppSessionManager instead, via the getAppSessionManager method.

Sets the SessionManager object associated with this application context. The SessionManager manages the different sessions to the Intelligence Server.

Parameters
sessionManager the session manager to associated with this AppContext

Protected Methods

protected String getEventHandlersCatalogPath ()

Returns the path to use for the EventHandlersCatalog file. This is only used if a EventHandlersCatalog has not been explicitly set through the setEventHandlersCatalog(EventHandlersCatalog). By default it returns an empty string. Other bean context can override this method to provide a different location.

protected String getMessagesManagerPath ()

Returns the path to use for the MessagesManager (locales) file. This is only used if a MessagesManager has not been explicitly set through the setMessagesManager(MessagesManager).

protected String getPageManagerPath ()

Returns the path to use for the PageManager file. This is only used if a PageManager has not been explicitly set through the setPageManager(PageManager). This method will calculate the path based on the configuration parameters in the ContainerServices.

protected String getStyleCatalogPath ()

Returns the path to use for the StyleCatalog file. This is only used if a StyleCatalog has not been explicitly set through the setStyleCatalog(StyleCatalog).