public interface

TaskRequestContext

com.microstrategy.web.tasks.TaskRequestContext
Known Indirect Subclasses

Class Overview

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.

Summary

Public Methods
abstract Block createMessageResultBlock(WebResultSetInstance wrsi)
This method creates a Block of type "MessageResult" and populates it with the properties of the supplied WebResultSetInstance object.
abstract Block getBlock(String blockName)
Gets a Block from the Block Library.
abstract String getBlockAssignmentMode()
Returns the default block assignment mode used for all Block creation.
abstract ContainerServices getContainerServices()
Returns the ContainerServices object associated with this request.
abstract String getContentType()
Gets the desired Content Type specified by the caller for this Task invocation.
abstract boolean getIsPolling()
Returns the isPolling flag
abstract String getMimeType()
Gets the desired MIME Type specified by the caller for this Task invocation.
abstract RequestKeys getRequestKeys()
Returns the RequestKeys object associated with this request.
abstract Block getRootBlock(String blockName, MarkupOutput markupOutput)
If a Task uses a Block to construct output content, then this method gets the "root" Block associated with a MarkupOutput object.
abstract WebIServerSession getWebIServerSession(String sessionStateParamName, String sessionIDParamName)
Returns the WebIServerSession object associated with this request.
abstract boolean isParameterEmpty(TaskParameterMetadata tpm)
This method checks if the the Task Parameter (identified by the TaskParameterMetadata) in a request is empty or not.
abstract void setBlockAssignmentMode(String blockMode)
Sets the default block assignment mode used for all Block creation.
abstract void setContainerServices(ContainerServices cntrSvcs)
Sets the ContainerServices object associated with this request.
abstract void setContentType(String contentType)
Sets the desired Content Type specified by the caller for this Task invocation.
abstract 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
abstract void setMimeType(String mimeType)
Sets the desired MIME Type specified by the caller for this Task invocation.
abstract void setPrivileges(WebPrivilegesExpression value)
Sets the task privileges.
abstract void setRequestKeys(RequestKeys requestKeys)
Sets the RequestKeys object associated with this request.
abstract void setRootBlock(Block block, MarkupOutput markupOutput)
This method sets the root Block of the markupOutput to the supplied Block.
abstract void setWebIServerSession(WebIServerSession wiss)
Sets the WebIServerSession object associated with this request.
abstract Block transformBlock(Block rootBlock, String blockScript)
Transform a Block into another form using a Block Transform "script".

Public Methods

public abstract Block createMessageResultBlock (WebResultSetInstance wrsi)

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.

public abstract Block getBlock (String blockName)

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.

public abstract String getBlockAssignmentMode ()

Returns the default block assignment mode used for all Block creation.

Returns
  • The default block assignment mode used for all Block creation.

public abstract ContainerServices getContainerServices ()

Returns the ContainerServices object associated with this request.

Returns

public abstract String getContentType ()

Gets the desired Content Type specified by the caller for this Task invocation.

Returns
  • The desired content type.

public abstract boolean getIsPolling ()

Returns the isPolling flag

public abstract String getMimeType ()

Gets the desired MIME Type specified by the caller for this Task invocation.

Returns
  • The desired MIME type.

public abstract RequestKeys getRequestKeys ()

Returns the RequestKeys object associated with this request.

Returns

public abstract Block getRootBlock (String blockName, MarkupOutput markupOutput)

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.

public abstract WebIServerSession getWebIServerSession (String sessionStateParamName, String sessionIDParamName)

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
Throws
TaskException if either the session state or session ID are invalid (TaskRequestMalformedException) or the session has timed out (TaskInternalException).

public abstract 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.

public abstract void setBlockAssignmentMode (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.

public abstract void setContainerServices (ContainerServices cntrSvcs)

Sets the ContainerServices object associated with this request.

Parameters
cntrSvcs The ContainerServices object associated with this request.

public abstract void setContentType (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.

public abstract 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

public abstract void setMimeType (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.

public abstract void setPrivileges (WebPrivilegesExpression value)

Sets the task privileges. The privileges will be verified when the task obtains a session

Parameters
value The privilege expression

public abstract void setRequestKeys (RequestKeys requestKeys)

Sets the RequestKeys object associated with this request.

Parameters
requestKeys The RequestKeys object associated with this request.

public abstract void setRootBlock (Block block, MarkupOutput markupOutput)

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.

public abstract void setWebIServerSession (WebIServerSession wiss)

Sets the WebIServerSession object associated with this request.

Parameters
wiss The WebIServerSession object to associate with this request.

public abstract Block transformBlock (Block rootBlock, String blockScript)

Transform a Block into another form using a Block Transform "script".

Parameters
rootBlock The root Block to perform the transformation on.
blockScript The script to perform on the root Block.
Returns
  • The root Block after the transformation.
Throws
BlockTransformScriptInvalid If the supplied Block script is syntactically invalid.
BlockTransformExecutionFailure If the Block script fails during execution.