com.microstrategy.web.beans.MarkupOutput |
![]() |
This object is used by a transform to record the results of a transformation. This object can be in two modes: text or binary. In text mode, all elements inside this object are of String type. In binary mode, all elements inside this object are of byte [] type. User can use the getBianryMode() method to check the mode. Before this object has any data, it will be in neither mode. But after the first element is added into the collection, its mode has been fixed. After the mode has been fixed, if user adds other type of data into this collection, or asks for the other type representation of this object, an IllegalStateException will be thrown. Inside this object, when it is in the text mode, we will keep the data into an array of StringBuffer. When user calls getTextChunkAt(i), the content of the ith StringBuffer in the array will be returned. User can control the StringBuffer's initial and maximum size by putting a properties file name 'MarkupOutput.properties" in the classpath. In this file, user should specify two properties: initBufferSize and maxBufferSize, which is in unit of character.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract void |
addBlock(Block block)
Adds a "root-level" Block to this MarkupOutput instance.
| ||||||||||
abstract void |
addErrorInfo(String error)
Append more error information to the MarkupOutput.
| ||||||||||
abstract void |
addHeader(String key, String value)
Adds a header with the specified key value pair.
| ||||||||||
abstract void |
append(String element)
Adds data at the end of the MarkupOutput object.
| ||||||||||
abstract void |
append(byte[] element)
Adds data at the end of the MarkupOutput object.
| ||||||||||
abstract void |
append(MarkupOutput element, boolean encode)
Adds data at the end of the EncodedMarkupOutput object.
| ||||||||||
abstract void |
append(ComponentBlock child)
Append a ComponentBlock object to the MarkupOutput
if the "primary" ComponentBlock is set it will be appended as its children
otherwise it will be appended to a list field and then gets appended to a ComponentBlock later
| ||||||||||
abstract void |
append(Object element)
Adds data at the end of the MarkupOutput object.
| ||||||||||
abstract void |
append(MarkupOutput element)
Adds data at the end of the MarkupOutput object.
| ||||||||||
abstract void | appendHtml(StringBuilder element) | ||||||||||
abstract void |
appendHtml(String element)
Adds encoded HTML data at the end of the MarkupOutput object.
| ||||||||||
abstract void |
appendHtmlAttributeTooltip(String element)
Adds encoded HTML data at the end of the MarkupOutput object.
| ||||||||||
abstract void |
appendJS(String element)
Adds encoded JSON data at the end of the MarkupOutput object.
| ||||||||||
abstract void |
appendJSForAttribute(String jsCode)
Adds encoded JavaScript code at the end of the MarkupOutput object.
| ||||||||||
abstract void |
appendUrl(String element)
Adds encoded URL data at the end of the MarkupOutput object.
| ||||||||||
abstract int |
chunkCount()
Returns the number of chunks contained in the MarkupOutput
object.
| ||||||||||
abstract byte[] |
getBinaryChunkAt(int i)
Returns the byte array chunk at the specified index.
| ||||||||||
abstract byte[] |
getBinaryContent()
Get all of the binary data in the MarkupOutput at once.
| ||||||||||
abstract boolean |
getBinaryMode()
Returns whether the output is set to collate binary or text
data.
| ||||||||||
abstract Block |
getBlock(int index)
Returns the ith "root level" Block associated with this
MarkupOutput object.
| ||||||||||
abstract BlockContext |
getBlockContext()
Returns the current "block context" object which is used for
BlockProperty value expansion and overall Block serialization. | ||||||||||
abstract int |
getBlockCount()
Returns the number of "root level" Blocks populated by a
transform or layout file and associated with this MarkupOutput
instance.
| ||||||||||
abstract List<ComponentBlock> |
getChildBlocks()
Gets the list of child ComponentBlocks
| ||||||||||
abstract ComponentBlock |
getComponentBlock()
Returns the "primpary" ComponentBlock this MarkupOutput instance holds
| ||||||||||
abstract int |
getContentLength()
Returns the length of the content.
| ||||||||||
abstract String |
getContentType()
Returns the content-type associated with this output.
| ||||||||||
abstract String |
getCopyAsString()
Returns the content of this object in the String format.
| ||||||||||
abstract StringBuffer |
getErrorInfo()
Returns the error information that is held by this MarkupOutput instance.
| ||||||||||
abstract int |
getHeaderCount()
Returns the header count.
| ||||||||||
abstract String |
getHeaderKey(int i)
Returns the header key at the specified index.
| ||||||||||
abstract String |
getHeaderValue(String key)
Returns the header value for the given header key.
| ||||||||||
abstract String |
getTextChunkAt(int i)
Returns the String chunk at the specified index.
| ||||||||||
abstract Object |
getUnserializedObject()
Gets the UnserializedObject member which is used to contain the
actual unprocessed output object.
| ||||||||||
abstract boolean |
hasChildBlocks()
Returns a flag indicating whether the child ComponentBlocks list is empty or not
| ||||||||||
abstract boolean |
hasComponentBlock()
Returns a flag indicating whether the "primary" ComponentBlock is set or not
| ||||||||||
abstract boolean |
hasErrorInfo()
Returns the flag which indicates whether this MarkupOutput instance has with error information recorded or not
| ||||||||||
abstract void |
send(OutputStream outStream)
The results are sent back to the user via the supplied
OutputStream object.
| ||||||||||
abstract void |
send(Writer writer)
The results are sent back to the user via the implicit out
object.
| ||||||||||
abstract void |
setBinaryContent(byte[] bytes)
Replaces the existing binary content with a new byte array.
| ||||||||||
abstract void |
setBlockContext(BlockContext blockContext)
Sets the current "block context" object which is used for
BlockProperty value expansion and overall Block serialization. | ||||||||||
abstract void |
setComponentBlock(ComponentBlock cb)
Sets the "primary" ComponentBlock on the MarkupOutput instance
once it's set all the other ComponentBlock will be appended as its children
| ||||||||||
abstract void |
setContentType(String contentType)
Sets the Content-Type associated with this output.
| ||||||||||
abstract void |
setErrorInfo(StringBuffer error)
Set error information onto the MarkupOutput.
| ||||||||||
abstract void |
setUnserializedObject(Object unserializedObject)
Sets the UnserializedObject member which is used to contain the
actual unprocessed output object.
|
Adds a "root-level" Block to this MarkupOutput instance. The fully populated Block can then be retrieved by the caller and integrated into a larger Block hierarchy.
block | The Block instance to add to this MarkupOutput
object. Note that only "top-level" Blocks should be added.
Nested Blocks need not be associated with this MarkupOutput
instance. |
---|
Append more error information to the MarkupOutput. If componentBlock is set the error will be get appended there otherwise this MarkupOutput instance will host the info.
error | the error information that needs to be added |
---|
Adds a header with the specified key value pair.
key | header key name. |
---|---|
value | header value. |
Adds data at the end of the MarkupOutput object.
element | the String wanted to be appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is at binary mode. |
Adds data at the end of the MarkupOutput object.
element | the byte array wanted to be appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is at text mode. |
Adds data at the end of the EncodedMarkupOutput object.
element | the String wanted to be appended to the collection. |
---|---|
encode | the Boolean indicating whether encode is needed or not upon appending. |
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is at binary mode. |
Append a ComponentBlock object to the MarkupOutput if the "primary" ComponentBlock is set it will be appended as its children otherwise it will be appended to a list field and then gets appended to a ComponentBlock later
child | the ComponentBlock that needs to be appended |
---|
Adds data at the end of the MarkupOutput object.
element | the object wanted to be appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is at binary mode. |
Adds data at the end of the MarkupOutput object. NOTE: The
current content in the input parameter will be added into this
MarkupOutput immediately. Future changes to the input parameter
element
will not be reflected in this MarkupOutput.
element | the object wanted to be appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if the mode of the current MarkupOutput is not compatible with the mode of the input MarkupOutput. |
IllegalArgumentException | |
---|---|
IllegalStateException |
Adds encoded HTML data at the end of the MarkupOutput object.
element | the String to be encoded and appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is in binary mode. |
Adds encoded HTML data at the end of the MarkupOutput object. In addition to HTML encoding, the data will be encoded for "\r", "\n", and "\t". These whitespace characters are respected in tool tips and so they must be properly encoded. For more information, see DE72585.
element | the String to be encoded and appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is in binary mode. |
Adds encoded JSON data at the end of the MarkupOutput object.
element | the String to be encoded and appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is in binary mode. |
Adds encoded JavaScript code at the end of the MarkupOutput object.
jsCode | String containing the JavaScript code to be encoded and appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is in binary mode. |
Adds encoded URL data at the end of the MarkupOutput object.
element | the String to be encoded and appended to the collection. |
---|
IllegalArgumentException | thrown if the element is null. |
---|---|
IllegalStateException | thrown if current MarkupOutput is in binary mode. |
UnsupportedEncodingException | thrown if the underlying encoding is not supported. |
Returns the number of chunks contained in the MarkupOutput object.
Returns the byte array chunk at the specified index.
i | the index of the element in the collection. |
---|
IndexOutOfBoundsException | thrown if no item in the collection has the given index. |
---|---|
IllegalStateException | thrown if current MarkupOutput is at text mode |
Get all of the binary data in the MarkupOutput at once.
IllegalStateException | If current MarkupOutput is in "text mode" |
---|
Returns whether the output is set to collate binary or text data. This is determined by inspecting the content of the first append operation. If no data has been appended, it will return false (i.e. text mode) by default.
Returns the ith "root level" Block associated with this MarkupOutput object.
index | The index of the Block to return. |
---|
Block
in this list.Returns the current "block context" object which is used for
BlockProperty
value expansion and overall Block serialization.
BlockContext
to use when converting a Block into a
serialized form in the MarkupOutput.Returns the number of "root level" Blocks populated by a transform or layout file and associated with this MarkupOutput instance.
Block
objects associated with this markup
output.Gets the list of child ComponentBlocks
Returns the "primpary" ComponentBlock this MarkupOutput instance holds
Returns the length of the content.
Returns the content-type associated with this output.
Returns the content of this object in the String format.
Returns the error information that is held by this MarkupOutput instance.
Returns the header count.
Returns the header key at the specified index.
i | index. |
---|
Returns the header value for the given header key.
key | header key. |
---|
Returns the String chunk at the specified index.
i | the index of the element in the collection. |
---|
IndexOutOfBoundsException | thrown if no chunk in the collection has the given index. |
---|---|
IllegalStateException | thrown if current MarkupOutput is at binary mode |
Gets the UnserializedObject member which is used to contain the actual unprocessed output object.
Returns a flag indicating whether the child ComponentBlocks list is empty or not
Returns a flag indicating whether the "primary" ComponentBlock is set or not
Returns the flag which indicates whether this MarkupOutput instance has with error information recorded or not
The results are sent back to the user via the supplied OutputStream object.
outStream | the binary output stream object. |
---|
IllegalStateException | thrown if current mode is text. |
---|---|
IOException |
The results are sent back to the user via the implicit out object.
writer | the implicit out object. |
---|
IllegalStateException | thrown if the current mode is binary. |
---|---|
IOException | thrown in case an error occurs while writing to the output. |
Replaces the existing binary content with a new byte array. The previous byte data is dropped.
bytes | The new byte array to be associated with this MarkupOutput. |
---|
IllegalStateException | If current MarkupOutput is in "text mode" |
---|
Sets the current "block context" object which is used for BlockProperty
value expansion and overall Block serialization.
blockContext | The BlockContext to use when converting a Block into
a serialized form in the MarkupOutput. |
---|
Sets the "primary" ComponentBlock on the MarkupOutput instance once it's set all the other ComponentBlock will be appended as its children
cb | the ComponentBlock to be set |
---|
Sets the Content-Type associated with this output.
contentType | the content type. |
---|
Set error information onto the MarkupOutput. If componentBlock is set the error will be set there otherwise this MarkupOutput instance will host the error info.
error | the StringBuffer with error information that needs to be set |
---|
Sets the UnserializedObject member which is used to contain the actual unprocessed output object.