Package com.microstrategy.web.controller
Class GenericWebAppController
- java.lang.Object
-
- com.microstrategy.web.controller.AppControllerImpl
-
- com.microstrategy.web.controller.GenericWebAppController
-
- All Implemented Interfaces:
AppController
- Direct Known Subclasses:
AdminController,MSTRWebController,ServerAdminController
public class GenericWebAppController extends AppControllerImpl
This class provides a generic implementation of AppController that suits many MicroStrategy web applications. This class contains much of the code from the MSTRWebController class.- Since:
- MicroStrategy Web 9.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected ControllerHelper.BlockLibraryInfo_blockLibraryInfoprotected java.lang.String_configServletPathprotected int_defaultEventprotected AppContext_globalAppContextprotected java.lang.String_iframeJSPprotected java.lang.String_iserverPollingFreqprotected long_messagesLastModifiedDeprecated.MessagesBundle will take care themselves to reload if necessary.protected MessagesManager_messagesManagerDeprecated.Get the pageManager fromBeanContext.getMessagesManager()or directly from theConfigurationFilesCache.protected long_pageConfigLastModifiedDeprecated.the pageConfig will take care itself to reload if necessary.protected PageManager_pageManagerDeprecated.Get the pageManager fromAppContext.getPageManager()or directly from theConfigurationFilesCache.protected boolean_reloadConfigFilesprotected java.lang.String_servletNameDeprecated.This variable should be marked private and will be removed in future versions of the product.protected java.lang.String_servletPathDeprecated.This variable should be marked private and will be removed in future versions of the product.protected StyleCatalog_styleCatalogDeprecated.Get the style catalog fromBeanContext.getStyleCatalog()or directly from theConfigurationFilesCache.protected long_styleCatalogLastModifiedDeprecated.the styleCatalog will take care itself to reload if necessary.protected java.lang.String_xhrJSPprotected static java.lang.StringSESSION_SESSION_MANAGERThe key to use for the Session Manager.
-
Constructor Summary
Constructors Constructor Description GenericWebAppController()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddStandardCacheHeaders(ContainerServices cs)AppContextcreateNewAppContext(ContainerServices cs)Deprecated.UsecreateNewAppContext(ContainerServices, boolean)instead.AppContextcreateNewAppContext(ContainerServices cs, boolean externalApp)Creates a new AppContextInstance.voiderrorAfterRedirect(RequestState reqState, java.lang.Exception e)Inform the application that the request has failed inside the redirected pagejava.lang.StringextractParameterFromURL(java.lang.String url, java.lang.String parameterName)protected ProductLicenseInfo[]getApplicableLicenses()java.lang.StringgetBaseURL(ContainerServices cs)Returns the root name to use on event links and as the action of the forms generated by the applicationprotected java.lang.StringgetDefaultURLLink(ServletWebComponent servletWebComponent)protected longgetLastModifiedTime(AppContext appContext, java.lang.String param)Deprecated.No longer used by the MicroStrategy Web controllers.java.lang.StringgetPage(RequestState reqState)Get the page to redirect to.voidinitializeApp(ContainerServices cs)Initialize our web application.ExternalSecuritynewExternalSecurity()Creates new instance of the ExternalSecurity component to be used for authenticating and authorizing users on each of their requests.RequestStatenewRequestState()Create a new per-request data structurebooleanprocessRequest(RequestState reqState)Handle an incoming HTTP Request.protected voidsetupSessionManager(AppContext appContext, ServletWebComponent servletWebComponent)voidterminateApp()Subclasses that override this method should invoke this via super.terminateApp to ensure threads and other application related resources are cleaned up properly.protected voidvalidateRandomNum(ContainerServices cs, AppContext appContext)Checks if validateRandNum token contains correct value if CSRF protection is enabled Places results in CSRFError httpsession attribute Enforcement of CSRFError httpsession attribute is in ServletEventHandlerImpl
-
-
-
Field Detail
-
SESSION_SESSION_MANAGER
protected static final java.lang.String SESSION_SESSION_MANAGER
The key to use for the Session Manager.- See Also:
- Constant Field Values
-
_pageManager
protected PageManager _pageManager
Deprecated.Get the pageManager fromAppContext.getPageManager()or directly from theConfigurationFilesCache.This used to be the instance of the PageManager used by this Controller. The Controller would initialized this instance in the initializeApp method, keep a reference and then assign it to the AppContext on every request.
Now all configuration files are cached by theConfigurationFilesCache, so if you need to access the page config, you can get a reference (based on the file path) from this Cache. The AppContextImpl will automatically try to get the PageManager from the Cache if a PageManager is not explicitly set.
-
_globalAppContext
protected AppContext _globalAppContext
-
_messagesManager
protected MessagesManager _messagesManager
Deprecated.Get the pageManager fromBeanContext.getMessagesManager()or directly from theConfigurationFilesCache.This used to be the instance of the MessagesManager used by this Controller. The Controller would initialized this instance in the initializeApp method, keep a reference and then assign it to the AppContext on every request.
Now all configuration files are cached by theConfigurationFilesCache, so if you need to access the page config, you can get a reference (based on the file path) from this Cache. The AppContextImpl will automatically try to get the MessagesManager from the Cache if a PageManager is not explicitly set.
-
_styleCatalog
protected StyleCatalog _styleCatalog
Deprecated.Get the style catalog fromBeanContext.getStyleCatalog()or directly from theConfigurationFilesCache.This used to be the instance of the StyleCatalog used by this Controller. The Controller would initialized this instance in the initializeApp method, keep a reference and then assign it to the AppContext on every request.
Now all configuration files are cached by theConfigurationFilesCache, so if you need to access the style catalog, you can get a reference (based on the file path) from this Cache. The AppContextImpl will automatically try to get the StyleCatalog from the Cache if a StyleCatalog is not explicitly set.
-
_defaultEvent
protected int _defaultEvent
-
_reloadConfigFiles
protected boolean _reloadConfigFiles
-
_configServletPath
protected java.lang.String _configServletPath
-
_xhrJSP
protected java.lang.String _xhrJSP
- Since:
- MicroStrategy Web 9.0.1
-
_iframeJSP
protected java.lang.String _iframeJSP
-
_iserverPollingFreq
protected java.lang.String _iserverPollingFreq
-
_servletName
protected java.lang.String _servletName
Deprecated.This variable should be marked private and will be removed in future versions of the product. You can callgetBaseURL(com.microstrategy.web.platform.ContainerServices)instead.
-
_servletPath
protected java.lang.String _servletPath
Deprecated.This variable should be marked private and will be removed in future versions of the product. You can callBeanContext.getServletPath()instead.
-
_pageConfigLastModified
protected long _pageConfigLastModified
Deprecated.the pageConfig will take care itself to reload if necessary.
-
_styleCatalogLastModified
protected long _styleCatalogLastModified
Deprecated.the styleCatalog will take care itself to reload if necessary.
-
_messagesLastModified
protected long _messagesLastModified
Deprecated.MessagesBundle will take care themselves to reload if necessary.
-
_blockLibraryInfo
protected ControllerHelper.BlockLibraryInfo _blockLibraryInfo
-
-
Method Detail
-
initializeApp
public void initializeApp(ContainerServices cs)
Description copied from interface:AppControllerInitialize our web application. Save all persistent data structures back into the implementation class as private data members.
-
newRequestState
public RequestState newRequestState()
Description copied from interface:AppControllerCreate a new per-request data structure- Returns:
RequestState
-
processRequest
public boolean processRequest(RequestState reqState)
Description copied from interface:AppControllerHandle an incoming HTTP Request. The state of the incoming request is saved back into the RequestState object for later review by the controller.- Returns:
- boolean
-
getDefaultURLLink
protected java.lang.String getDefaultURLLink(ServletWebComponent servletWebComponent)
-
errorAfterRedirect
public void errorAfterRedirect(RequestState reqState, java.lang.Exception e)
Description copied from interface:AppControllerInform the application that the request has failed inside the redirected page
-
getPage
public java.lang.String getPage(RequestState reqState)
Description copied from interface:AppControllerGet the page to redirect to. Must handle the case that an error was found before redirection. In such a case, the page returned should be an error page.- Returns:
- String
-
getBaseURL
public java.lang.String getBaseURL(ContainerServices cs)
Description copied from interface:AppControllerReturns the root name to use on event links and as the action of the forms generated by the application- Returns:
- String
-
newExternalSecurity
public ExternalSecurity newExternalSecurity()
Description copied from interface:AppControllerCreates new instance of the ExternalSecurity component to be used for authenticating and authorizing users on each of their requests.- Returns:
- new instance of the ExternalSecurity component.
-
terminateApp
public void terminateApp()
Description copied from class:AppControllerImplSubclasses that override this method should invoke this via super.terminateApp to ensure threads and other application related resources are cleaned up properly.- Specified by:
terminateAppin interfaceAppController- Overrides:
terminateAppin classAppControllerImpl
-
createNewAppContext
public AppContext createNewAppContext(ContainerServices cs)
Deprecated.UsecreateNewAppContext(ContainerServices, boolean)instead.Creates a new AppContext instance.- Parameters:
cs- TheContainerServicesinstance of the caller.- Returns:
- A populated
AppContextinstance.
-
createNewAppContext
public AppContext createNewAppContext(ContainerServices cs, boolean externalApp)
Creates a new AppContextInstance.- Parameters:
cs- TheContainerServicesinstance of the caller.externalApp- If this is being called from an external application (one other than MicroStrategy Web), then the following properties are set on the new instance:- styleCatalog
- pageManager
- messagesManager
-
setupSessionManager
protected void setupSessionManager(AppContext appContext, ServletWebComponent servletWebComponent) throws WebAppException
- Throws:
WebAppException
-
getLastModifiedTime
protected long getLastModifiedTime(AppContext appContext, java.lang.String param)
Deprecated.No longer used by the MicroStrategy Web controllers.Gets teh last modified time of a resource.- Parameters:
appContext- TheAppContextto use for resolving resource parameters.param- The name of the resource to check.- Returns:
- A long value for the last modified time.
-
getApplicableLicenses
protected ProductLicenseInfo[] getApplicableLicenses() throws LicensingException
- Throws:
LicensingException
-
addStandardCacheHeaders
protected void addStandardCacheHeaders(ContainerServices cs)
-
extractParameterFromURL
public java.lang.String extractParameterFromURL(java.lang.String url, java.lang.String parameterName)
-
validateRandomNum
protected void validateRandomNum(ContainerServices cs, AppContext appContext) throws WebException
Checks if validateRandNum token contains correct value if CSRF protection is enabled Places results in CSRFError httpsession attribute Enforcement of CSRFError httpsession attribute is in ServletEventHandlerImpl- Parameters:
cs-appContext-- Throws:
WebException
-
-