Class 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 constant PARAM_NAME_TASK_ENVELOPE) and the task Content Type (know through the constant PARAM_NAME_TASK_CONTENT_TYPE). The task ID identifies the registered Task, 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
    • 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
    • Constructor Detail

      • TaskProcessorController

        public TaskProcessorController()
        Creates a new TaskProcessorController object.
    • Method Detail

      • initializeApp

        public void initializeApp​(ContainerServices cs)
        Initialize the application.
        Parameters:
        cs - The ContainerServices object to use to complete the initialization.
      • newRequestState

        public RequestState newRequestState()
        Get a new RequestState object to handle the incoming request.
        Returns:
        A new RequestState object to handle the incoming request.
      • processRequest

        public boolean processRequest​(RequestState reqState)
        Process the incoming request.
        Parameters:
        reqState - The RequestState object 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 - The RequestState object 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 - The RequestState object that holds per-request data.
        e - The Exception was raised.
      • getBaseURL

        public java.lang.String getBaseURL​(ContainerServices cs)
        The Base URL for this application.
        Parameters:
        cs - The ContainerServices object that exposes a variety of services.
        Returns:
        The base URL for this application.
      • getTaskFactory

        public TaskFactory getTaskFactory()
        Returns task factory singleton
        Returns:
        TaskFactory instance
      • initializeEnvelopeTypes

        protected void initializeEnvelopeTypes​(ContainerServices cs)
      • getTaskEnvelopeNames

        public java.util.List<java.lang.String> getTaskEnvelopeNames​(boolean sorted)
      • 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()