public class

BlockContext

extends Object
java.lang.Object
   ↳ com.microstrategy.web.blocks.BlockContext

Class Overview

This class holds context information used for any Block interactions. This includes a reference to a Renderer that is used to render a Block tree as well as default assignment modes. It is also used to hold data structures that are used by BlockPropertyMacro instances.

Resolution of the Renderer. If a specific object instance is supplied for the renderer, it is used directly. If not supplied, then renderer to use is based on the evaluation of several properties of this object. Here is the order that BlockContext properties are evaluated in selecting the renderer.

  1. Renderer Instance. If one has been supplied (or computed in a previous invocation) it is used.
  2. Renderer FQCN. If a fully qualified class name is supplied it is used to create an instance of the renderer by reflection.

See Also

Summary

Public Constructors
BlockContext()
No args constructor.
BlockContext(BeanContext beanContext)
Constructor which takes a BeanContext instance.
BlockContext(WebBean webBean)
Constructor which takes a WebBean instance.
Public Methods
ContainerServices getContainerServices()
Returns the ContainerServices instance to use for any macro expansion.
String getDefaultContentType()
Returns the default content type to use if no other properties select the renderer.
ContentEncoderChain getEncoderChain()
Returns the chain of encoders.
Messages getMessages()
Returns the Messages to be used with Blocks.
String getMode()
Returns the default mode to use for any Block creations.
Preferences getPreferences()
Returns the Preferences associated with this BlockContext.
Renderer getRenderer()
Returns the Renderer instance to use with Blocks.
String getRendererFQCN()
Returns the Renderer fully qualified class name to use with Blocks.
RequestKeys getRequestKeys()
Returns the RequestKeys instance that may be used to determine desired content type to use.
String getUnconditionalContentType()
Returns the unconditional content type to use for determining the renderer to use.
WebIServerSession getWebIServerSession()
Returns the WebIServerSession object associated with this BlockContext.
void setContainerServices(ContainerServices cs)
Sets the ContainerServices instance to use for any macro expansion.
void setDefaultContentType(String defaultContentType)
Sets the default content type to use if no other properties select the renderer.
void setEncoderChain(String encoders)
Specify the list of encoders to be used.
void setMessages(Messages messages)
Sets the Messages to be used with Blocks.
void setMode(String mode)
Sets the default mode to use for any Block creations.
void setPreferences(Preferences preferences)
Sets the Preferences object to associate with this BlockContext.
void setRenderer(Renderer renderer)
Sets the Renderer instance to use with Blocks.
void setRendererFQCN(String fqcn)
Sets the Renderer fully qualified class name to use with Blocks.
void setRequestKeys(RequestKeys requestKeys)
Sets the RequestKeys instance that may be used to determine desired content type to use.
void setUnconditionalContentType(String unconditionalContentType)
Sets the unconditional content type to use for determining the renderer to use.
void setWebIServerSession(WebIServerSession wiss)
Sets the WebIServerSession object associated with this BlockContext.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public BlockContext ()

No args constructor.

public BlockContext (BeanContext beanContext)

Constructor which takes a BeanContext instance. It retrieves values from the supplied BeanContext object to associate with this context. They include:

  • Request Keys
  • Container Services
  • Messages

Parameters
beanContext An existing BeanContext object.

public BlockContext (WebBean webBean)

Constructor which takes a WebBean instance. In addition to retrieving context from the WebBean's BeanContext, it also tries to retrieve the following value:

  • WebIServerSession

Parameters
webBean An existing WebBean object.

Public Methods

public ContainerServices getContainerServices ()

Returns the ContainerServices instance to use for any macro expansion.

Returns

public String getDefaultContentType ()

Returns the default content type to use if no other properties select the renderer.

Returns
  • The default content type to use if no other properties select the renderer.

public ContentEncoderChain getEncoderChain ()

Returns the chain of encoders. It will be null if no encoder has been set on this context.

Returns
  • the chain of encoders. null may be returned if no encoders has been set on it.

public Messages getMessages ()

Returns the Messages to be used with Blocks.

Returns

public String getMode ()

Returns the default mode to use for any Block creations.

Returns
  • The default mode to use for any Block creations.

public Preferences getPreferences ()

Returns the Preferences associated with this BlockContext.

Returns
  • The Preferences object associated with this BlockContext. If none was supplied explicitly, and a WebIServerSession was supplied, a Preferences instance is created.

public Renderer getRenderer ()

Returns the Renderer instance to use with Blocks. It returns the instance specified with setRenderer(Renderer) or an instance which can be created from one of the other properties set in this context object

Returns

public String getRendererFQCN ()

Returns the Renderer fully qualified class name to use with Blocks.

Returns
  • The Renderer fully qualified class name to use with Blocks.

public RequestKeys getRequestKeys ()

Returns the RequestKeys instance that may be used to determine desired content type to use.

Returns
  • The RequestKeys instance that may be used to determine desired content type to use.

public String getUnconditionalContentType ()

Returns the unconditional content type to use for determining the renderer to use.

Returns
  • The unconditional content type to use for determining the renderer to use.

public WebIServerSession getWebIServerSession ()

Returns the WebIServerSession object associated with this BlockContext.

Returns

public void setContainerServices (ContainerServices cs)

Sets the ContainerServices instance to use for any macro expansion.

Parameters
cs The ContainerServices instance to use for any macro expansion.

public void setDefaultContentType (String defaultContentType)

Sets the default content type to use if no other properties select the renderer.

Parameters
defaultContentType The default content type to use if no other properties select the renderer.

public void setEncoderChain (String encoders)

Specify the list of encoders to be used.

Parameters
encoders - comma delimited string of encoder names. For e.g. "JSON,HTML".

public void setMessages (Messages messages)

Sets the Messages to be used with Blocks.

Parameters
messages The Messages instance.

public void setMode (String mode)

Sets the default mode to use for any Block creations.

Parameters
mode The default mode to use for any Block creations.

public void setPreferences (Preferences preferences)

Sets the Preferences object to associate with this BlockContext.

Parameters
preferences The Preferences object to associate with this BlockContext.

public void setRenderer (Renderer renderer)

Sets the Renderer instance to use with Blocks.

Parameters
renderer The Renderer instance to use.

public void setRendererFQCN (String fqcn)

Sets the Renderer fully qualified class name to use with Blocks.

Parameters
fqcn The fully qualified class name of the Renderer instance to use.

public void setRequestKeys (RequestKeys requestKeys)

Sets the RequestKeys instance that may be used to determine desired content type to use.

Parameters
requestKeys The RequestKeys instance that may be used to determine desired content type to use.

public void setUnconditionalContentType (String unconditionalContentType)

Sets the unconditional content type to use for determining the renderer to use.

Parameters
unconditionalContentType The content type to use for selecting the renderer

public void setWebIServerSession (WebIServerSession wiss)

Sets the WebIServerSession object associated with this BlockContext.

Parameters
wiss The WebIServerSession object to associate with this context.