Interface UIBodyWriter

All Known Subinterfaces:
UIAjaxContext, UIComponentWriter, UIFormPaneWriter, UIFormWriter, UILabelRendererContext, UILabelRendererForHierarchyContext, UIResponseContext, UIServiceComponentWriter, UITableFilterResponseContext, UserServicePaneWriter, UserServiceRawPaneWriter, UserServiceWriter, WidgetWriter, WidgetWriterForList

public interface UIBodyWriter
This interface provides methods for adding text to the body of a document. According to the type of the document (that is, HTML page, Ajax response, etc.), the text can be HTML code, simple text, a JSON structure or CSV values.

Important: To prevent XSS issues, the methods addSafeAttribute(String, String) and addSafeInnerHTML(String) must be used.

The use of the script tag (<script>) is strongly discouraged. It is recommended to use the UIJavaScriptWriter instead.

Since:
5.2.0
See Also:
  • Method Details

    • add

      UIBodyWriter add(String aString)
      Adds the specified string to the body stream.
      Parameters:
      aString - body content (HTML or simple text, depending on the document type).
    • addSafeInnerHTML

      UIBodyWriter addSafeInnerHTML(String text)
      Escapes all '<' and '>' characters in the given string, then adds the string to the body stream. This method must be used in order to avoid cross-site scripting (XSS) issues.
      Parameters:
      text - body content (HTML or simple text, depending on the document type).
      Since:
      5.4.0
    • addSafeInnerHTML

      UIBodyWriter addSafeInnerHTML(UserMessage aUserMessage)
      See Also:
    • addSafeAttribute

      UIBodyWriter addSafeAttribute(String aName, String aValue)
      Adds an HTML attribute to the body stream, following the pattern:

      aName="aValue"

      If the given attribute value contains double quotes, the quotes will be escaped.

      This method must be used to avoid cross-site scripting (XSS) issues.
      Parameters:
      aName - the name of the attribute
      aValue - the value of the attribute
      Since:
      5.4.0
    • addSafeAttribute

      UIBodyWriter addSafeAttribute(String aName, UserMessage aValue)
      Adds an HTML attribute to the body stream, following the pattern:

      aName="aValue"

      If the given attribute value contains double quotes, the quotes will be escaped.

      This method must be used to avoid cross-site scripting (XSS) issues.
      Parameters:
      aName - the name of the attribute
      aValue - the value of the attribute
      Since:
      5.4.0
    • add

      UIBodyWriter add(int integer)
      Adds an integer to the body stream.
      Parameters:
      integer - an integer to add to the body.
    • add

      UIBodyWriter add(UserMessage aUserMessage)
      Adds a user message in the current session's locale to the body stream.
      Parameters:
      aUserMessage - a user message.
    • add_cr

      UIBodyWriter add_cr()
      Adds a carriage return to the body stream. To keep the body source easier to read by a human, does not add the HTML tag <br/>.
    • add_cr

      UIBodyWriter add_cr(String text)
      Adds the specified string to the body stream, then adds a carriage return to the body stream. To keep the body source easier to read by a human, does not add the HTML tag <br/>.
      Parameters:
      text - body content (HTML or simple text according the document type).