Class TaskProcessorController
- java.lang.Object
-
- com.microstrategy.web.controller.AppControllerImpl
-
- com.microstrategy.web.controller.TaskProcessorController
-
- All Implemented Interfaces:
AppController
public class TaskProcessorController extends AppControllerImpl
This class is the AppController implementation for the TaskProcessor servlet. It contains the majority of the logic for handling incoming task requests, dispatching them to the appropriate tasks and formatting their results for the desired consumer.
This controller is responsible for generating the entire task response. There are two parts to this response: the envelope and the payload. The "payload" is easiest to understand: it is the result generated by the underlying task. The "envelope" is the markup that encapsulates the "payload". The envelope is often structured for the caller's consumption.
For example, the IFRAME envelope consists of a full HTML document with the BODY element specifying a JavaScript function to invoke for the 'onload' handler. An XMLHttpRequest envelope will contain less "wiring" to indicate when the request is complete.
Three HTTP parameters are relevant at this stage of task processing: the task ID (known through the constant
TaskProcessor.PARAM_NAME_TASK_ID), the task envelope (known through the constantPARAM_NAME_TASK_ENVELOPE) and the task Content Type (know through the constantPARAM_NAME_TASK_CONTENT_TYPE). The task ID identifies the registeredTask, the envelope specifies a set of pages that are used to contain the payload and the content type specifies the desired output format. If omitted, it defaults to whatever is specified by the envelope.- Since:
- MicroStrategy Web 8.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classTaskProcessorController.TaskEnvelope
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPARAM_NAME_TASK_CONTENT_ENCODINGThe HTTP Parameter that specifies the desired transfer encoding for the content generated by the Task.static java.lang.StringPARAM_NAME_TASK_CONTENT_TYPEThe HTTP Parameter that specifies the desired content type for the Task.static java.lang.StringPARAM_NAME_TASK_ENVELOPEThe HTTP Parameter that specifies the type of envelope to use to containing the response.static java.lang.StringREQ_ATTR_TASK_RESPONSE_CONTEXTThe name of the HTTP Request Attribute that contains the TaskProcessorResponseContext object.
-
Constructor Summary
Constructors Constructor Description TaskProcessorController()Creates a new TaskProcessorController object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderrorAfterRedirect(RequestState reqState, java.lang.Exception e)What to do if there is an error after we have redirected to the target page.com.microstrategy.web.controller.TaskProcessorController.InterfacePagesgetAdminPages()java.lang.StringgetBaseURL(ContainerServices cs)The Base URL for this application.java.lang.StringgetDefaultEnvelopeID()java.lang.StringgetPage(RequestState reqState)Get the relative path to the Page that should be displayed.java.util.Set<java.lang.String>getPrivateTaskIDs()TaskProcessorController.TaskEnvelopegetTaskEnvelope(TaskProcessorRequestState tprState)java.util.List<java.lang.String>getTaskEnvelopeNames(boolean sorted)TaskFactorygetTaskFactory()Returns task factory singletonTaskProcessorgetTaskProcessor()com.microstrategy.web.controller.TaskProcessorController.InterfacePagesgetViewerPages()voidinitializeApp(ContainerServices cs)Initialize the application.protected voidinitializeEnvelopeTypes(ContainerServices cs)ExternalSecuritynewExternalSecurity()Creates a newExternalSecurityobject.RequestStatenewRequestState()Get a newRequestStateobject to handle the incoming request.booleanprocessRequest(RequestState reqState)Process the incoming request.booleanshowPrivateTaskIDs()voidterminateApp()Terminate the application.
-
-
-
Field Detail
-
PARAM_NAME_TASK_ENVELOPE
public static final java.lang.String PARAM_NAME_TASK_ENVELOPE
The HTTP Parameter that specifies the type of envelope to use to containing the response.- See Also:
- Constant Field Values
-
PARAM_NAME_TASK_CONTENT_TYPE
public static final java.lang.String PARAM_NAME_TASK_CONTENT_TYPE
The HTTP Parameter that specifies the desired content type for the Task.- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
PARAM_NAME_TASK_CONTENT_ENCODING
public static final java.lang.String PARAM_NAME_TASK_CONTENT_ENCODING
The HTTP Parameter that specifies the desired transfer encoding for the content generated by the Task.- See Also:
- Constant Field Values
-
REQ_ATTR_TASK_RESPONSE_CONTEXT
public static final java.lang.String REQ_ATTR_TASK_RESPONSE_CONTEXT
The name of the HTTP Request Attribute that contains the TaskProcessorResponseContext object.- See Also:
- Constant Field Values
-
-
Method Detail
-
initializeApp
public void initializeApp(ContainerServices cs)
Initialize the application.- Parameters:
cs- TheContainerServicesobject to use to complete the initialization.
-
newRequestState
public RequestState newRequestState()
Get a newRequestStateobject to handle the incoming request.- Returns:
- A new
RequestStateobject to handle the incoming request.
-
processRequest
public boolean processRequest(RequestState reqState)
Process the incoming request.- Parameters:
reqState- TheRequestStateobject that holds per-request data.- Returns:
- True, if the request was handled; otherwise, false.
-
getPage
public java.lang.String getPage(RequestState reqState)
Get the relative path to the Page that should be displayed.- Parameters:
reqState- TheRequestStateobject that contains per-request data structures.- Returns:
- The path to the Page to internally redirect to.
-
errorAfterRedirect
public void errorAfterRedirect(RequestState reqState, java.lang.Exception e)
What to do if there is an error after we have redirected to the target page.- Parameters:
reqState- TheRequestStateobject that holds per-request data.e- TheExceptionwas raised.
-
getBaseURL
public java.lang.String getBaseURL(ContainerServices cs)
The Base URL for this application.- Parameters:
cs- TheContainerServicesobject that exposes a variety of services.- Returns:
- The base URL for this application.
-
newExternalSecurity
public ExternalSecurity newExternalSecurity()
Creates a newExternalSecurityobject.- Returns:
- A new
ExternalSecurityobject.
-
terminateApp
public void terminateApp()
Terminate the application.- Specified by:
terminateAppin interfaceAppController- Overrides:
terminateAppin classAppControllerImpl
-
getTaskProcessor
public TaskProcessor getTaskProcessor()
-
getTaskFactory
public TaskFactory getTaskFactory()
Returns task factory singleton- Returns:
TaskFactoryinstance
-
initializeEnvelopeTypes
protected void initializeEnvelopeTypes(ContainerServices cs)
-
getTaskEnvelopeNames
public java.util.List<java.lang.String> getTaskEnvelopeNames(boolean sorted)
-
getTaskEnvelope
public TaskProcessorController.TaskEnvelope getTaskEnvelope(TaskProcessorRequestState tprState)
-
getDefaultEnvelopeID
public java.lang.String getDefaultEnvelopeID()
-
getAdminPages
public com.microstrategy.web.controller.TaskProcessorController.InterfacePages getAdminPages()
-
getViewerPages
public com.microstrategy.web.controller.TaskProcessorController.InterfacePages getViewerPages()
-
getPrivateTaskIDs
public java.util.Set<java.lang.String> getPrivateTaskIDs()
-
showPrivateTaskIDs
public boolean showPrivateTaskIDs()
-
-