Package com.microstrategy.web.blocks
Class BlockContext
- java.lang.Object
-
- com.microstrategy.web.blocks.BlockContext
-
public class BlockContext extends java.lang.Object
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.
- 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 aBeanContext
instance.BlockContext(WebBean webBean)
Constructor which takes aWebBean
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContainerServices
getContainerServices()
Returns the ContainerServices instance to use for any macro expansion.java.lang.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.java.lang.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.java.lang.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.java.lang.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(java.lang.String defaultContentType)
Sets the default content type to use if no other properties select the renderer.void
setEncoderChain(java.lang.String encoders)
Specify the list of encoders to be used.void
setMessages(Messages messages)
Sets the Messages to be used with Blocks.void
setMode(java.lang.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(java.lang.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(java.lang.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.
-
-
-
Constructor Detail
-
BlockContext
public BlockContext()
No args constructor.
-
BlockContext
public BlockContext(BeanContext beanContext)
Constructor which takes aBeanContext
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.
-
BlockContext
public BlockContext(WebBean webBean)
Constructor which takes aWebBean
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.- See Also:
BlockContext(BeanContext)
-
-
Method Detail
-
getMessages
public Messages getMessages()
Returns the Messages to be used with Blocks.- Returns:
- The
Messages
instance.
-
setMessages
public void setMessages(Messages messages)
Sets the Messages to be used with Blocks.- Parameters:
messages
- TheMessages
instance.
-
getContainerServices
public ContainerServices getContainerServices()
Returns the ContainerServices instance to use for any macro expansion.- Returns:
- The
ContainerServices
instance to use for any macro expansion.
-
setContainerServices
public void setContainerServices(ContainerServices cs)
Sets the ContainerServices instance to use for any macro expansion.- Parameters:
cs
- TheContainerServices
instance 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
Renderer
instance to use.
-
setRenderer
public void setRenderer(Renderer renderer)
Sets the Renderer instance to use with Blocks.- Parameters:
renderer
- TheRenderer
instance 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 theRenderer
instance 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
RequestKeys
instance 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
- TheRequestKeys
instance 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
WebIServerSession
object associated with this BlockContext.
-
setWebIServerSession
public void setWebIServerSession(WebIServerSession wiss)
Sets the WebIServerSession object associated with this BlockContext.- Parameters:
wiss
- TheWebIServerSession
object to associate with this context.
-
getPreferences
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. - See Also:
setWebIServerSession(WebIServerSession)
-
setPreferences
public void setPreferences(Preferences preferences)
Sets the Preferences object to associate with this BlockContext.- Parameters:
preferences
- ThePreferences
object 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 benull
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.
-
-