Package com.microstrategy.web.beans
Interface MarkupOutput
- 
- All Known Subinterfaces:
- EncodedMarkupOutput
 
 public interface MarkupOutputThis 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.- Since:
- MicroStrategy Web 7.3.1 or earlier
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBlock(Block block)Adds a "root-level" Block to this MarkupOutput instance.voidaddErrorInfo(java.lang.String error)Append more error information to the MarkupOutput.voidaddHeader(java.lang.String key, java.lang.String value)Adds a header with the specified key value pair.voidappend(byte[] element)Adds data at the end of the MarkupOutput object.voidappend(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 latervoidappend(MarkupOutput element)Adds data at the end of the MarkupOutput object.voidappend(MarkupOutput element, boolean encode)Adds data at the end of the EncodedMarkupOutput object.voidappend(java.lang.Object element)Adds data at the end of the MarkupOutput object.voidappend(java.lang.String element)Adds data at the end of the MarkupOutput object.voidappendHtml(java.lang.String element)Adds encoded HTML data at the end of the MarkupOutput object.voidappendHtml(java.lang.StringBuilder element)voidappendHtmlAttributeTooltip(java.lang.String element)Adds encoded HTML data at the end of the MarkupOutput object.voidappendJS(java.lang.String element)Adds encoded JSON data at the end of the MarkupOutput object.voidappendJSForAttribute(java.lang.String jsCode)Adds encoded JavaScript code at the end of the MarkupOutput object.voidappendUrl(java.lang.String element)Adds encoded URL data at the end of the MarkupOutput object.intchunkCount()Returns the number of chunks contained in the MarkupOutput object.byte[]getBinaryChunkAt(int i)Returns the byte array chunk at the specified index.byte[]getBinaryContent()Get all of the binary data in the MarkupOutput at once.booleangetBinaryMode()Returns whether the output is set to collate binary or text data.BlockgetBlock(int index)Returns the ith "root level" Block associated with this MarkupOutput object.BlockContextgetBlockContext()Returns the current "block context" object which is used forBlockPropertyvalue expansion and overall Block serialization.intgetBlockCount()Returns the number of "root level" Blocks populated by a transform or layout file and associated with this MarkupOutput instance.java.util.List<ComponentBlock>getChildBlocks()Gets the list of child ComponentBlocksComponentBlockgetComponentBlock()Returns the "primpary" ComponentBlock this MarkupOutput instance holdsintgetContentLength()Returns the length of the content.java.lang.StringgetContentType()Returns the content-type associated with this output.java.lang.StringgetCopyAsString()Returns the content of this object in the String format.java.lang.StringBuffergetErrorInfo()Returns the error information that is held by this MarkupOutput instance.intgetHeaderCount()Returns the header count.java.lang.StringgetHeaderKey(int i)Returns the header key at the specified index.java.lang.StringgetHeaderValue(java.lang.String key)Returns the header value for the given header key.java.lang.StringgetTextChunkAt(int i)Returns the String chunk at the specified index.java.lang.ObjectgetUnserializedObject()Gets the UnserializedObject member which is used to contain the actual unprocessed output object.booleanhasChildBlocks()Returns a flag indicating whether the child ComponentBlocks list is empty or notbooleanhasComponentBlock()Returns a flag indicating whether the "primary" ComponentBlock is set or notbooleanhasErrorInfo()Returns the flag which indicates whether this MarkupOutput instance has with error information recorded or notvoidsend(java.io.OutputStream outStream)The results are sent back to the user via the supplied OutputStream object.voidsend(java.io.Writer writer)The results are sent back to the user via the implicit out object.voidsetBinaryContent(byte[] bytes)Replaces the existing binary content with a new byte array.voidsetBlockContext(BlockContext blockContext)Sets the current "block context" object which is used forBlockPropertyvalue expansion and overall Block serialization.voidsetComponentBlock(ComponentBlock cb)Sets the "primary" ComponentBlock on the MarkupOutput instance once it's set all the other ComponentBlock will be appended as its childrenvoidsetContentType(java.lang.String contentType)Sets the Content-Type associated with this output.voidsetErrorInfo(java.lang.StringBuffer error)Set error information onto the MarkupOutput.voidsetUnserializedObject(java.lang.Object unserializedObject)Sets the UnserializedObject member which is used to contain the actual unprocessed output object.
 
- 
- 
- 
Method Detail- 
sendvoid send(java.io.Writer writer) throws java.lang.IllegalStateException, java.io.IOExceptionThe results are sent back to the user via the implicit out object.- Parameters:
- writer- the implicit out object.
- Throws:
- java.lang.IllegalStateException- thrown if the current mode is binary.
- java.io.IOException- thrown in case an error occurs while writing to the output.
 
 - 
sendvoid send(java.io.OutputStream outStream) throws java.lang.IllegalStateException, java.io.IOExceptionThe results are sent back to the user via the supplied OutputStream object.- Parameters:
- outStream- the binary output stream object.
- Throws:
- java.lang.IllegalStateException- thrown if current mode is text.
- java.io.IOException
 
 - 
appendvoid append(MarkupOutput element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException 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 parameterelementwill not be reflected in this MarkupOutput.- Parameters:
- element- the object wanted to be appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if the mode of the current MarkupOutput is not compatible with the mode of the input MarkupOutput.
 
 - 
appendvoid append(java.lang.String element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionAdds data at the end of the MarkupOutput object.- Parameters:
- element- the String wanted to be appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is at binary mode.
 
 - 
appendHtmlvoid appendHtml(java.lang.String element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionAdds encoded HTML data at the end of the MarkupOutput object.- Parameters:
- element- the String to be encoded and appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is in binary mode.
 
 - 
appendHtmlvoid appendHtml(java.lang.StringBuilder element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException- Throws:
- java.lang.IllegalArgumentException
- java.lang.IllegalStateException
 
 - 
appendHtmlAttributeTooltipvoid appendHtmlAttributeTooltip(java.lang.String element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionAdds 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.- Parameters:
- element- the String to be encoded and appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is in binary mode.
 
 - 
appendJSvoid appendJS(java.lang.String element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionAdds encoded JSON data at the end of the MarkupOutput object.- Parameters:
- element- the String to be encoded and appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is in binary mode.
 
 - 
appendJSForAttributevoid appendJSForAttribute(java.lang.String jsCode) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionAdds encoded JavaScript code at the end of the MarkupOutput object.- Parameters:
- jsCode- String containing the JavaScript code to be encoded and appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is in binary mode.
 
 - 
appendUrlvoid appendUrl(java.lang.String element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.io.UnsupportedEncodingExceptionAdds encoded URL data at the end of the MarkupOutput object.- Parameters:
- element- the String to be encoded and appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is in binary mode.
- java.io.UnsupportedEncodingException- thrown if the underlying encoding is not supported.
 
 - 
appendvoid append(byte[] element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionAdds data at the end of the MarkupOutput object.- Parameters:
- element- the byte array wanted to be appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is at text mode.
 
 - 
appendvoid append(java.lang.Object element) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionAdds data at the end of the MarkupOutput object.- Parameters:
- element- the object wanted to be appended to the collection.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is at binary mode.
 
 - 
appendvoid append(MarkupOutput element, boolean encode) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException Adds data at the end of the EncodedMarkupOutput object.- Parameters:
- element- the String wanted to be appended to the collection.
- encode- the Boolean indicating whether encode is needed or not upon appending.
- Throws:
- java.lang.IllegalArgumentException- thrown if the element is null.
- java.lang.IllegalStateException- thrown if current MarkupOutput is at binary mode.
 
 - 
getTextChunkAtjava.lang.String getTextChunkAt(int i) throws java.lang.IndexOutOfBoundsException, java.lang.IllegalStateExceptionReturns the String chunk at the specified index.- Parameters:
- i- the index of the element in the collection.
- Returns:
- string chunk at the specified index.
- Throws:
- java.lang.IndexOutOfBoundsException- thrown if no chunk in the collection has the given index.
- java.lang.IllegalStateException- thrown if current MarkupOutput is at binary mode
 
 - 
getBinaryChunkAtbyte[] getBinaryChunkAt(int i) throws java.lang.IndexOutOfBoundsException, java.lang.IllegalStateExceptionReturns the byte array chunk at the specified index.- Parameters:
- i- the index of the element in the collection.
- Returns:
- The byte array at the specified index.
- Throws:
- java.lang.IndexOutOfBoundsException- thrown if no item in the collection has the given index.
- java.lang.IllegalStateException- thrown if current MarkupOutput is at text mode
 
 - 
getBinaryContentbyte[] getBinaryContent() throws java.lang.IllegalStateExceptionGet all of the binary data in the MarkupOutput at once.- Returns:
- A single byte array that contains all binary content. If there is no binary data, null is returned.
- Throws:
- java.lang.IllegalStateException- If current MarkupOutput is in "text mode"
 
 - 
setBinaryContentvoid setBinaryContent(byte[] bytes) throws java.lang.IllegalStateExceptionReplaces the existing binary content with a new byte array. The previous byte data is dropped.- Parameters:
- bytes- The new byte array to be associated with this MarkupOutput.
- Throws:
- java.lang.IllegalStateException- If current MarkupOutput is in "text mode"
 
 - 
chunkCountint chunkCount() Returns the number of chunks contained in the MarkupOutput object.- Returns:
- number of elements in the MarkupOutput object.
 
 - 
getBinaryModeboolean getBinaryMode() 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:
- true=binary, false=text mode.
 
 - 
getContentTypejava.lang.String getContentType() Returns the content-type associated with this output.- Returns:
- the content type
 
 - 
getContentLengthint getContentLength() Returns the length of the content.- Returns:
- The length of the content (the number of bytes if it's binary, or the number of characters if it's not).
- Since:
- MicroStrategy Web 7.5.0
 
 - 
setContentTypevoid setContentType(java.lang.String contentType) Sets the Content-Type associated with this output.- Parameters:
- contentType- the content type.
 
 - 
addHeadervoid addHeader(java.lang.String key, java.lang.String value)Adds a header with the specified key value pair.- Parameters:
- key- header key name.
- value- header value.
 
 - 
getHeaderCountint getHeaderCount() Returns the header count.- Returns:
- the header count.
 
 - 
getHeaderKeyjava.lang.String getHeaderKey(int i) Returns the header key at the specified index.- Parameters:
- i- index.
- Returns:
- the header key.
 
 - 
getHeaderValuejava.lang.String getHeaderValue(java.lang.String key) Returns the header value for the given header key.- Parameters:
- key- header key.
- Returns:
- header value.
 
 - 
getCopyAsStringjava.lang.String getCopyAsString() Returns the content of this object in the String format.- Returns:
- a String representing the current content.
 
 - 
getBlockCountint getBlockCount() Returns the number of "root level" Blocks populated by a transform or layout file and associated with this MarkupOutput instance.- Returns:
- The number of Blockobjects associated with this markup output.
- Since:
- MicroStrategy Web 8.1.0
 
 - 
getBlockBlock getBlock(int index) Returns the ith "root level" Block associated with this MarkupOutput object.- Parameters:
- index- The index of the Block to return.
- Returns:
- The ith Blockin this list.
- Since:
- MicroStrategy Web 8.1.0
 
 - 
addBlockvoid addBlock(Block block) 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.- Parameters:
- block- The- Blockinstance 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.
- Since:
- MicroStrategy Web 8.1.0
 
 - 
getBlockContextBlockContext getBlockContext() Returns the current "block context" object which is used forBlockPropertyvalue expansion and overall Block serialization.- Returns:
- The BlockContextto use when converting a Block into a serialized form in the MarkupOutput.
- Since:
- MicroStrategy Web 9.0.0
 
 - 
setBlockContextvoid setBlockContext(BlockContext blockContext) Sets the current "block context" object which is used forBlockPropertyvalue expansion and overall Block serialization.- Parameters:
- blockContext- The- BlockContextto use when converting a Block into a serialized form in the MarkupOutput.
- Since:
- MicroStrategy Web 9.0.0
 
 - 
setUnserializedObjectvoid setUnserializedObject(java.lang.Object unserializedObject) Sets the UnserializedObject member which is used to contain the actual unprocessed output object.- Since:
- MicroStrategy Web 9.0.0
 
 - 
getUnserializedObjectjava.lang.Object getUnserializedObject() Gets the UnserializedObject member which is used to contain the actual unprocessed output object.- Since:
- MicroStrategy Web 9.0.0
 
 - 
setComponentBlockvoid 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- Parameters:
- cb- the ComponentBlock to be set
 
 - 
hasComponentBlockboolean hasComponentBlock() Returns a flag indicating whether the "primary" ComponentBlock is set or not- Returns:
- boolean true if set false if not
 
 - 
getComponentBlockComponentBlock getComponentBlock() Returns the "primpary" ComponentBlock this MarkupOutput instance holds- Returns:
- the ComponentBlock instance
 
 - 
appendvoid 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- Parameters:
- child- the ComponentBlock that needs to be appended
 
 - 
getChildBlocksjava.util.List<ComponentBlock> getChildBlocks() Gets the list of child ComponentBlocks- Returns:
- Listthe block list 
 
 - 
hasChildBlocksboolean hasChildBlocks() Returns a flag indicating whether the child ComponentBlocks list is empty or not- Returns:
- boolean true if it contains child ComponentBlocks false otherwise
 
 - 
hasErrorInfoboolean hasErrorInfo() Returns the flag which indicates whether this MarkupOutput instance has with error information recorded or not- Returns:
- boolean true if it contains error information false otherwise
 
 - 
addErrorInfovoid addErrorInfo(java.lang.String error) 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.- Parameters:
- error- the error information that needs to be added
 
 - 
getErrorInfojava.lang.StringBuffer getErrorInfo() Returns the error information that is held by this MarkupOutput instance.- Returns:
- StringBuffer the StringBuffer that holds the error information
 
 - 
setErrorInfovoid setErrorInfo(java.lang.StringBuffer error) 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.- Parameters:
- error- the StringBuffer with error information that needs to be set
 
 
- 
 
-