public class

BaseTaskRequestContext

extends Object
implements TaskRequestContext
java.lang.Object
   ↳ com.microstrategy.web.tasks.BaseTaskRequestContext
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This class implements the TaskRequestContext interface by managing a reference to a ContainerServices, a RequestKeys and a WebIServerSession object.

Summary

Constants
String BLK_MESSAGE_RESULT
String BLP_MESSAGE_RESULT_MESSAGE_ID
String BLP_MESSAGE_RESULT_MESSAGE_STATE_ID
String BLP_MESSAGE_RESULT_MESSAGE_STATUS
Fields
protected WebPrivilegesExpression mPrivileges
Public Constructors
BaseTaskRequestContext()
Public Methods
Block createMessageResultBlock(WebResultSetInstance wrsi)
This method creates a Block of type "MessageResult" and populates it with the properties of the supplied WebResultSetInstance object.
Block getBlock(String blockName, int blockMode)
This method is deprecated. Please use getBlock(String) instead
Block getBlock(String blockName)
Gets a Block from the Block Library.
String getBlockAssignmentMode()
Returns the default block assignment mode used for all Block creation.
ContainerServices getContainerServices()
Returns the ContainerServices object associated with this request.
String getContentType()
Gets the desired Content Type specified by the caller for this Task invocation.
boolean getIsPolling()
Returns the isPolling flag
String getMimeType()
Gets the desired MIME Type specified by the caller for this Task invocation.
RequestKeys getRequestKeys()
Returns the RequestKeys object associated with this request.
Block getRootBlock(String blockName, int blockMode)
This method is deprecated. Please use getRootBlock(String, MarkupOutput) instead
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.
WebIServerSession getWebIServerSession(String sessionStateParamName, String sessionIDParamName, boolean checkSessionAliveness)
WebIServerSession getWebIServerSession(String sessionStateParamName, String sessionIDParamName)
Returns the WebIServerSession object associated with this request.
boolean isParameterEmpty(TaskParameterMetadata tpm)
This method checks if the the Task Parameter (identified by the TaskParameterMetadata) in a request is empty or not.
void setBlockAssignmentMode(String blockMode)
Sets the default block assignment mode used for all Block creation.
void setContainerServices(ContainerServices cntrSvcs)
Sets the ContainerServices object associated with this request.
void setContentType(String contentType)
Sets the desired Content Type specified by the caller for this Task invocation.
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
void setMimeType(String mimeType)
Sets the desired MIME Type specified by the caller for this Task invocation.
void setPrivileges(WebPrivilegesExpression privileges)
Stores the task privileges to check them when we get a session
void setRequestKeys(RequestKeys requestKeys)
Sets the RequestKeys object associated with this request.
void setRootBlock(Block rootBlock, MarkupOutput markupOutput)
This method sets the root Block of the markupOutput to the supplied Block.
void setWebIServerSession(WebIServerSession wiss)
Sets the WebIServerSession object associated with this request.
Block transformBlock(Block rootBlock, String blockScript)
Transform a Block into another form using a Block Transform "script".
Protected Methods
void checkPrivileges()
void checkSessionAliveness(WebIServerSession wiss)
Checks whether the supplied WebIServerSession instance is alive or not.
BeanContext getBeanContext()
BlockContext getBlockContext(MarkupOutput markupOutput)
Returns the BlockContext object associated with this MarkupOutput.
WebIServerSession getWebIServerSession()
Returns the held WebIServerSession instance.
WebIServerSession restoreSessionFromStateOrId(String sessionStateParamName, String sessionIDParamName)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.microstrategy.web.tasks.TaskRequestContext

Constants

public static final String BLK_MESSAGE_RESULT

Constant Value: "MessageResult"

public static final String BLP_MESSAGE_RESULT_MESSAGE_ID

Constant Value: "id"

public static final String BLP_MESSAGE_RESULT_MESSAGE_STATE_ID

Constant Value: "st"

public static final String BLP_MESSAGE_RESULT_MESSAGE_STATUS

Constant Value: "status"

Fields

protected WebPrivilegesExpression mPrivileges

Public Constructors

public BaseTaskRequestContext ()

Public Methods

public 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

public Block getBlock (String blockName, int blockMode)

This method is 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.

public 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

public 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 ContainerServices getContainerServices ()

Returns the ContainerServices object associated with this request.

Returns

public String getContentType ()

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

Returns
  • The desired content type.

public boolean getIsPolling ()

Returns the isPolling flag

public String getMimeType ()

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

Returns
  • The desired MIME type.

public RequestKeys getRequestKeys ()

Returns the RequestKeys object associated with this request.

Returns

public Block getRootBlock (String blockName, int blockMode)

This method is deprecated.
Please use getRootBlock(String, MarkupOutput) instead

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.

public 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

public WebIServerSession getWebIServerSession (String sessionStateParamName, String sessionIDParamName, boolean checkSessionAliveness)

Throws
TaskException

public 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

public 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 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 void setContainerServices (ContainerServices cntrSvcs)

Sets the ContainerServices object associated with this request.

Parameters
cntrSvcs The ContainerServices object associated with this request.

public 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 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 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 void setPrivileges (WebPrivilegesExpression privileges)

Stores the task privileges to check them when we get a session

Parameters
privileges The privilege expression

public void setRequestKeys (RequestKeys requestKeys)

Sets the RequestKeys object associated with this request.

Parameters
requestKeys The RequestKeys object associated with this request.

public void setRootBlock (Block rootBlock, 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
rootBlock the Block object.
markupOutput The MarkupOutput that should contain the root block.

public void setWebIServerSession (WebIServerSession wiss)

Sets the WebIServerSession object associated with this request.

Parameters
wiss The WebIServerSession object to associate with this request.

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

Protected Methods

protected void checkPrivileges ()

Throws
TaskException

protected void checkSessionAliveness (WebIServerSession wiss)

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).

protected BeanContext getBeanContext ()

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

protected WebIServerSession getWebIServerSession ()

Returns the held WebIServerSession instance.

Returns
  • The WebIServerSession instance.

protected WebIServerSession restoreSessionFromStateOrId (String sessionStateParamName, String sessionIDParamName)