Class BaseTaskRequestContext

    • Field Detail

      • BLK_MESSAGE_RESULT

        public static final java.lang.String BLK_MESSAGE_RESULT
        See Also:
        Constant Field Values
      • BLP_MESSAGE_RESULT_MESSAGE_STATUS

        public static final java.lang.String BLP_MESSAGE_RESULT_MESSAGE_STATUS
        See Also:
        Constant Field Values
      • BLP_MESSAGE_RESULT_MESSAGE_ID

        public static final java.lang.String BLP_MESSAGE_RESULT_MESSAGE_ID
        See Also:
        Constant Field Values
      • BLP_MESSAGE_RESULT_MESSAGE_STATE_ID

        public static final java.lang.String BLP_MESSAGE_RESULT_MESSAGE_STATE_ID
        See Also:
        Constant Field Values
      • BLP_MESSAGE_RESULT_PARTIAL_MANIPULATIONS

        public static final java.lang.String BLP_MESSAGE_RESULT_PARTIAL_MANIPULATIONS
        See Also:
        Constant Field Values
    • Constructor Detail

      • BaseTaskRequestContext

        public BaseTaskRequestContext()
    • Method Detail

      • getWebIServerSession

        public WebIServerSession getWebIServerSession​(java.lang.String sessionStateParamName,
                                                      java.lang.String sessionIDParamName)
                                               throws TaskException
        Description copied from interface: TaskRequestContext
        Returns the WebIServerSession object associated with this request. Session information may be serialized in many forms. It may be in the form of a "session state" or it may be as just the "session ID". This method can inspect the incoming request for either of these forms (based on how the caller wants to identify the names of these parameters) and if present, constructs a WebIServerSession object. It is held in this context object for later retrieval in this request. Here is the order in which a WebIServerSession object is provided:
        1. If there is already a non-null WebIServerSession object, it is returned.
        2. If there is a non-empty key which denotes the session state, it is evaluated and a WebIServerSession is returned.
        3. If there is a non-empty key which denotes the session ID, it is assigned to a newly created WebIServerSession and returned.
        If a key name is not supplied (i.e., is null), then that serialized form is not inspected.
        Specified by:
        getWebIServerSession in interface TaskRequestContext
        Parameters:
        sessionStateParamName - The name of the incoming request key ("parameter name") that contains a session state.
        sessionIDParamName - The name of the incoming request key ("parameter name") that contains a session ID.
        Returns:
        The WebIServerSession object associated with this request.
        Throws:
        TaskException - if either the session state or session ID are invalid (TaskRequestMalformedException) or the session has timed out (TaskInternalException).
      • getWebIServerSession

        public WebIServerSession getWebIServerSession​(java.lang.String sessionStateParamName,
                                                      java.lang.String sessionIDParamName,
                                                      boolean checkSessionAliveness)
                                               throws TaskException
        Throws:
        TaskException
      • getRootBlock

        public Block getRootBlock​(java.lang.String blockName,
                                  MarkupOutput markupOutput)
                           throws TaskException
        Description copied from interface: TaskRequestContext
        If a Task uses a Block to construct output content, then this method gets the "root" Block associated with a MarkupOutput object. If the root Block has already been constructed, it is returned. Otherwise, the Block is instantiated using the information supplied. In addition to creating the root block, the BlockContext is constructed and associated with the MarkupOutput object. This enables the constructed Block tree to automatically serialized according the specified content type. The default block assignment mode is consulted when creating this Block.
        Specified by:
        getRootBlock in interface TaskRequestContext
        Parameters:
        blockName - The name of the Block to create. If null or an empty string, then an "anonymous" block is created.
        markupOutput - The MarkupOutput that should contain the root block.
        Returns:
        A Block which can then by further populated by the Task.
        Throws:
        TaskException - If the Block cannot be created (e.g. it does not exist) or if there is no BlockRenderer associated with the specified content type.
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        TaskRequestContext.getBlockAssignmentMode()
      • isParameterEmpty

        public boolean isParameterEmpty​(TaskParameterMetadata tpm)
        Description copied from interface: TaskRequestContext
        This method checks if the the Task Parameter (identified by the TaskParameterMetadata) in a request is empty or not.
        Specified by:
        isParameterEmpty in interface TaskRequestContext
        Parameters:
        tpm - the TaskParameterMetadata object.
        Returns:
        A boolean value that tells if the Parameter in the request is empty or not.
        Since:
        MicroStrategy Web 9.0.0
      • getBlockAssignmentMode

        public java.lang.String getBlockAssignmentMode()
        Description copied from interface: TaskRequestContext
        Returns the default block assignment mode used for all Block creation.
        Specified by:
        getBlockAssignmentMode in interface TaskRequestContext
        Returns:
        The default block assignment mode used for all Block creation.
        Since:
        MicroStrategy Web 9.0.0
      • setBlockAssignmentMode

        public void setBlockAssignmentMode​(java.lang.String blockMode)
        Description copied from interface: TaskRequestContext
        Sets the default block assignment mode used for all Block creation.
        Specified by:
        setBlockAssignmentMode in interface TaskRequestContext
        Parameters:
        blockMode - The block assignment mode to use for all Block creation.
        Since:
        MicroStrategy Web 9.0.0
      • getBlock

        public Block getBlock​(java.lang.String blockName)
                       throws TaskException
        Description copied from interface: TaskRequestContext
        Gets a Block from the Block Library. This is merely a helper function that throws an exception if a block is not present in the library. The default block assignment mode is consulted when creating this Block.
        Specified by:
        getBlock in interface TaskRequestContext
        Parameters:
        blockName - The name of the Block. If null or an empty string, then an "anonymous" block is created.
        Returns:
        A Block to be used by this task.
        Throws:
        TaskException - If the Block cannot be created.
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        TaskRequestContext.getBlockAssignmentMode()
      • getContentType

        public java.lang.String getContentType()
        Description copied from interface: TaskRequestContext
        Gets the desired Content Type specified by the caller for this Task invocation.
        Specified by:
        getContentType in interface TaskRequestContext
        Returns:
        The desired content type.
        Since:
        MicroStrategy Web 9.0.0
      • setContentType

        public void setContentType​(java.lang.String contentType)
        Description copied from interface: TaskRequestContext
        Sets the desired Content Type specified by the caller for this Task invocation. The value should correspond to an entry in the ContentTypes properties file (e.g., "JSON" or "XML"). This method also overrides the MIME type if the supplied content type corresponds to an entry in the ContentTypes property file. The ConentTypes property file defines a MIME type for each entry.
        Specified by:
        setContentType in interface TaskRequestContext
        Parameters:
        contentType - The desired content type.
        Since:
        MicroStrategy Web 9.0.0
      • setMimeType

        public void setMimeType​(java.lang.String mimeType)
        Description copied from interface: TaskRequestContext
        Sets the desired MIME Type specified by the caller for this Task invocation. The value should be a standard MIME type (e.g., "application/json" or "text/xml").
        Specified by:
        setMimeType in interface TaskRequestContext
        Parameters:
        mimeType - The desired MIME type.
      • getRootBlock

        @Deprecated
        public Block getRootBlock​(java.lang.String blockName,
                                  int blockMode)
                           throws TaskConfigurationException
        Deprecated.
        Gets the Root Block associated with this Task. If the root Block has already been requested, it is returned. Otherwise, the Block is instantiated using the information supplied.
        Parameters:
        blockName - The name of the Block.
        blockMode - The mode used to instantiate the Block.
        Returns:
        A Block to be used by this task.
        Throws:
        TaskConfigurationException - If the Block cannot be created.
      • getBlock

        @Deprecated
        public Block getBlock​(java.lang.String blockName,
                              int blockMode)
                       throws TaskConfigurationException
        Deprecated.
        Please use getBlock(String) instead
        Gets a Block from the Block Library.
        Parameters:
        blockName - The name of the Block.
        blockMode - The mode used to instantiate the Block.
        Returns:
        A Block to be used by this task.
        Throws:
        TaskConfigurationException - If the Block cannot be created.
      • getWebIServerSession

        protected WebIServerSession getWebIServerSession()
        Returns the held WebIServerSession instance.
        Returns:
        The WebIServerSession instance.
        Since:
        MicroStrategy Web 9.0.1
      • getBlockContext

        protected BlockContext getBlockContext​(MarkupOutput markupOutput)
        Returns the BlockContext object associated with this MarkupOutput. If none exists, then one is created. It is automatically populated with the following fields:
        • Content Type
        • Container Services
        • Request Keys
        Parameters:
        markupOutput - The MarkupOutput object that hosts the BlockContext.
        Returns:
        The BlockContext object associated with this MarkupOutput.
        Since:
        MicroStrategy Web 9.0.0
      • checkSessionAliveness

        protected void checkSessionAliveness​(WebIServerSession wiss)
                                      throws TaskException
        Checks whether the supplied WebIServerSession instance is alive or not.
        Parameters:
        wiss - The WebIServerSession instance to check for.
        Throws:
        TaskException - If the WebIServerSession instance is not alive (that is, there is no longer a "live" session on the Intelligence Server open).
        Since:
        MicroStrategy Web 9.0.0
      • setIsPolling

        public void setIsPolling​(boolean value)
        Description copied from interface: TaskRequestContext
        Sets the isPolling flag indicating whether this task is in polling state (waiting for server response while polling with the client) Useful to set the response to client accordingly
        Specified by:
        setIsPolling in interface TaskRequestContext