예제 #1
0
 /**
  * Adds an XHTML body to the message.
  *
  * @param message the message that will receive the XHTML body
  * @param body the string to add as an XHTML body to the message
  */
 public static void addBody(Message message, String body) {
   XHTMLExtension xhtmlExtension = (XHTMLExtension) message.getExtension("html", namespace);
   if (xhtmlExtension == null) {
     // Create an XHTMLExtension and add it to the message
     xhtmlExtension = new XHTMLExtension();
     message.addExtension(xhtmlExtension);
   }
   // Add the required bodies to the message
   xhtmlExtension.addBody(body);
 }
예제 #2
0
 /**
  * Returns an Iterator for the XHTML bodies in the message. Returns null if the message does not
  * contain an XHTML extension.
  *
  * @param message an XHTML message
  * @return an Iterator for the bodies in the message or null if none.
  */
 public static List<String> getBodies(Message message) {
   XHTMLExtension xhtmlExtension = (XHTMLExtension) message.getExtension("html", namespace);
   if (xhtmlExtension != null) return xhtmlExtension.getBodies();
   else return null;
 }