Interface TaskRequestContext

  • All Known Implementing Classes:
    AppTaskRequestContext, BaseTaskRequestContext, BeanTaskRequestContext

    public interface TaskRequestContext
    This interface represents the context in which a Task request is occurring. It should contain all per-request data as a single Task instance is created to handle all requests.
    Since:
    MicroStrategy Web 8.1.0
    • Method Detail

      • getContainerServices

        ContainerServices getContainerServices()
        Returns the ContainerServices object associated with this request.
        Returns:
        The ContainerServices object associated with this request.
      • getRequestKeys

        RequestKeys getRequestKeys()
        Returns the RequestKeys object associated with this request.
        Returns:
        The RequestKeys object associated with this request.
      • setContainerServices

        void setContainerServices​(ContainerServices cntrSvcs)
        Sets the ContainerServices object associated with this request.
        Parameters:
        cntrSvcs - The ContainerServices object associated with this request.
      • setRequestKeys

        void setRequestKeys​(RequestKeys requestKeys)
        Sets the RequestKeys object associated with this request.
        Parameters:
        requestKeys - The RequestKeys object associated with this request.
      • getContentType

        java.lang.String getContentType()
        Gets the desired Content Type specified by the caller for this Task invocation.
        Returns:
        The desired content type.
        Since:
        MicroStrategy Web 9.0.0
      • setContentType

        void setContentType​(java.lang.String contentType)
        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.
        Parameters:
        contentType - The desired content type.
        Since:
        MicroStrategy Web 9.0.0
      • getMimeType

        java.lang.String getMimeType()
        Gets the desired MIME Type specified by the caller for this Task invocation.
        Returns:
        The desired MIME type.
        See Also:
        setContentType(String)
      • setMimeType

        void setMimeType​(java.lang.String mimeType)
        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").
        Parameters:
        mimeType - The desired MIME type.
      • getWebIServerSession

        WebIServerSession getWebIServerSession​(java.lang.String sessionStateParamName,
                                               java.lang.String sessionIDParamName)
                                        throws TaskException
        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.
        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).
        Since:
        MicroStrategy Web 9.0.0
      • setWebIServerSession

        void setWebIServerSession​(WebIServerSession wiss)
        Sets the WebIServerSession object associated with this request.
        Parameters:
        wiss - The WebIServerSession object to associate with this request.
        Since:
        MicroStrategy Web 9.0.0
      • getRootBlock

        Block getRootBlock​(java.lang.String blockName,
                           MarkupOutput markupOutput)
                    throws TaskException
        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.
        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:
        getBlockAssignmentMode()
      • setRootBlock

        void setRootBlock​(Block block,
                          MarkupOutput markupOutput)
                   throws TaskException
        This method sets the root Block of the markupOutput to the supplied 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.
        Parameters:
        block - the Block object.
        markupOutput - The MarkupOutput that should contain the root block.
        Throws:
        TaskException - is thrown if there is no BlockRenderer associated with the specified content type.
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        getRootBlock(String, MarkupOutput)
      • createMessageResultBlock

        Block createMessageResultBlock​(WebResultSetInstance wrsi)
                                throws TaskException
        This method creates a Block of type "MessageResult" and populates it with the properties of the supplied WebResultSetInstance object.
        Parameters:
        wrsi - The WebResultSetInstance object
        Returns:
        A MessageResult block
        Throws:
        TaskException - if we are unable to create the Block or populate its contents.
      • isParameterEmpty

        boolean isParameterEmpty​(TaskParameterMetadata tpm)
        This method checks if the the Task Parameter (identified by the TaskParameterMetadata) in a request is empty or not.
        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
      • getBlock

        Block getBlock​(java.lang.String blockName)
                throws TaskException
        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.
        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:
        getBlockAssignmentMode()
      • getBlockAssignmentMode

        java.lang.String getBlockAssignmentMode()
        Returns the default block assignment mode used for all Block creation.
        Returns:
        The default block assignment mode used for all Block creation.
        Since:
        MicroStrategy Web 9.0.0
      • setBlockAssignmentMode

        void setBlockAssignmentMode​(java.lang.String blockMode)
        Sets the default block assignment mode used for all Block creation.
        Parameters:
        blockMode - The block assignment mode to use for all Block creation.
        Since:
        MicroStrategy Web 9.0.0
      • setPrivileges

        void setPrivileges​(WebPrivilegesExpression value)
        Sets the task privileges. The privileges will be verified when the task obtains a session
        Parameters:
        value - The privilege expression
      • setIsPolling

        void setIsPolling​(boolean value)
        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
        Parameters:
        value -
      • getIsPolling

        boolean getIsPolling()
        Returns the isPolling flag
        Returns: