Package com.microstrategy.web.blocks
Class BlockContext
- java.lang.Object
 - 
- com.microstrategy.web.blocks.BlockContext
 
 
- 
public class BlockContext extends java.lang.ObjectThis 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.
- Renderer Instance. If one has been supplied (or computed in a previous invocation) it is used.
 - Renderer FQCN. If a fully qualified class name is supplied it is used to create an instance of the renderer by reflection.
 
- Since:
 - MicroStrategy Web 9.0.0
 - See Also:
 ContentTypes
 
- 
- 
Constructor Summary
Constructors Constructor Description BlockContext()No args constructor.BlockContext(BeanContext beanContext)Constructor which takes aBeanContextinstance.BlockContext(WebBean webBean)Constructor which takes aWebBeaninstance. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContainerServicesgetContainerServices()Returns the ContainerServices instance to use for any macro expansion.java.lang.StringgetDefaultContentType()Returns the default content type to use if no other properties select the renderer.ContentEncoderChaingetEncoderChain()Returns the chain of encoders.MessagesgetMessages()Returns the Messages to be used with Blocks.java.lang.StringgetMode()Returns the default mode to use for any Block creations.PreferencesgetPreferences()Returns the Preferences associated with this BlockContext.RenderergetRenderer()Returns the Renderer instance to use with Blocks.java.lang.StringgetRendererFQCN()Returns the Renderer fully qualified class name to use with Blocks.RequestKeysgetRequestKeys()Returns the RequestKeys instance that may be used to determine desired content type to use.java.lang.StringgetUnconditionalContentType()Returns the unconditional content type to use for determining the renderer to use.WebIServerSessiongetWebIServerSession()Returns the WebIServerSession object associated with this BlockContext.voidsetContainerServices(ContainerServices cs)Sets the ContainerServices instance to use for any macro expansion.voidsetDefaultContentType(java.lang.String defaultContentType)Sets the default content type to use if no other properties select the renderer.voidsetEncoderChain(java.lang.String encoders)Specify the list of encoders to be used.voidsetMessages(Messages messages)Sets the Messages to be used with Blocks.voidsetMode(java.lang.String mode)Sets the default mode to use for any Block creations.voidsetPreferences(Preferences preferences)Sets the Preferences object to associate with this BlockContext.voidsetRenderer(Renderer renderer)Sets the Renderer instance to use with Blocks.voidsetRendererFQCN(java.lang.String fqcn)Sets the Renderer fully qualified class name to use with Blocks.voidsetRequestKeys(RequestKeys requestKeys)Sets the RequestKeys instance that may be used to determine desired content type to use.voidsetUnconditionalContentType(java.lang.String unconditionalContentType)Sets the unconditional content type to use for determining the renderer to use.voidsetWebIServerSession(WebIServerSession wiss)Sets the WebIServerSession object associated with this BlockContext. 
 - 
 
- 
- 
Constructor Detail
- 
BlockContext
public BlockContext()
No args constructor. 
- 
BlockContext
public BlockContext(BeanContext beanContext)
Constructor which takes aBeanContextinstance. 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.
 
- 
BlockContext
public BlockContext(WebBean webBean)
Constructor which takes aWebBeaninstance. 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.- See Also:
 BlockContext(BeanContext)
 
 - 
 
- 
Method Detail
- 
getMessages
public Messages getMessages()
Returns the Messages to be used with Blocks.- Returns:
 - The 
Messagesinstance. 
 
- 
setMessages
public void setMessages(Messages messages)
Sets the Messages to be used with Blocks.- Parameters:
 messages- TheMessagesinstance.
 
- 
getContainerServices
public ContainerServices getContainerServices()
Returns the ContainerServices instance to use for any macro expansion.- Returns:
 - The 
ContainerServicesinstance to use for any macro expansion. 
 
- 
setContainerServices
public void setContainerServices(ContainerServices cs)
Sets the ContainerServices instance to use for any macro expansion.- Parameters:
 cs- TheContainerServicesinstance to use for any macro expansion.
 
- 
getRenderer
public Renderer getRenderer()
Returns the Renderer instance to use with Blocks. It returns the instance specified withsetRenderer(Renderer)or an instance which can be created from one of the other properties set in this context object- Returns:
 - The 
Rendererinstance to use. 
 
- 
setRenderer
public void setRenderer(Renderer renderer)
Sets the Renderer instance to use with Blocks.- Parameters:
 renderer- TheRendererinstance to use.
 
- 
getRendererFQCN
public java.lang.String getRendererFQCN()
Returns the Renderer fully qualified class name to use with Blocks.- Returns:
 - The Renderer fully qualified class name to use with Blocks.
 
 
- 
setRendererFQCN
public void setRendererFQCN(java.lang.String fqcn)
Sets the Renderer fully qualified class name to use with Blocks.- Parameters:
 fqcn- The fully qualified class name of theRendererinstance to use.
 
- 
getMode
public java.lang.String getMode()
Returns the default mode to use for any Block creations.- Returns:
 - The default mode to use for any Block creations.
 
 
- 
setMode
public void setMode(java.lang.String mode)
Sets the default mode to use for any Block creations.- Parameters:
 mode- The default mode to use for any Block creations.
 
- 
getUnconditionalContentType
public java.lang.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.
 
 
- 
setUnconditionalContentType
public void setUnconditionalContentType(java.lang.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
 
- 
getDefaultContentType
public java.lang.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.
 
 
- 
setDefaultContentType
public void setDefaultContentType(java.lang.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.
 
- 
getRequestKeys
public RequestKeys getRequestKeys()
Returns the RequestKeys instance that may be used to determine desired content type to use.- Returns:
 - The 
RequestKeysinstance that may be used to determine desired content type to use. 
 
- 
setRequestKeys
public void setRequestKeys(RequestKeys requestKeys)
Sets the RequestKeys instance that may be used to determine desired content type to use.- Parameters:
 requestKeys- TheRequestKeysinstance that may be used to determine desired content type to use.
 
- 
getWebIServerSession
public WebIServerSession getWebIServerSession()
Returns the WebIServerSession object associated with this BlockContext.- Returns:
 - The 
WebIServerSessionobject associated with this BlockContext. 
 
- 
setWebIServerSession
public void setWebIServerSession(WebIServerSession wiss)
Sets the WebIServerSession object associated with this BlockContext.- Parameters:
 wiss- TheWebIServerSessionobject to associate with this context.
 
- 
getPreferences
public Preferences getPreferences()
Returns the Preferences associated with this BlockContext.- Returns:
 - The 
Preferencesobject associated with this BlockContext. If none was supplied explicitly, and a WebIServerSession was supplied, a Preferences instance is created. - See Also:
 setWebIServerSession(WebIServerSession)
 
- 
setPreferences
public void setPreferences(Preferences preferences)
Sets the Preferences object to associate with this BlockContext.- Parameters:
 preferences- ThePreferencesobject to associate with this BlockContext.
 
- 
setEncoderChain
public void setEncoderChain(java.lang.String encoders)
Specify the list of encoders to be used.- Parameters:
 encoders- - comma delimited string of encoder names. For e.g. "JSON,HTML".- Since:
 - MicroStrategy Web 9.0.1
 
 
- 
getEncoderChain
public ContentEncoderChain getEncoderChain()
Returns the chain of encoders. It will benullif no encoder has been set on this context.- Returns:
 - the chain of encoders. 
nullmay be returned if no encoders has been set on it. 
 
 - 
 
 -