Class XMLReply

java.lang.Object
com.iizix.ws.engine.xml.XMLReply
All Implemented Interfaces:
IReplyContent

public class XMLReply extends Object implements IReplyContent
Class for a JSON reply.
Author:
Christopher Mindus
  • Constructor Details Link icon

    • XMLReply Link icon

      public XMLReply()
      Creates a new instance without data, used for a new Request.
    • XMLReply Link icon

      public XMLReply(Document doc)
      Wraps a reply to a document that is already loaded.
      Parameters:
      doc - A previously loaded document reply.
  • Method Details Link icon

    • getAcceptedContent Link icon

      public String getAcceptedContent()
      Gets the accepted contents.
      Specified by:
      getAcceptedContent in interface IReplyContent
      Returns:
      A String such as "text/html" or "text/plain, text/html".
    • isHandled Link icon

      public boolean isHandled(String type)
      Checks if a content type is handled by this reply.
      Specified by:
      isHandled in interface IReplyContent
      Parameters:
      type - The content type from the HTTP header "Content-Type", without "charset". The type is in lower case.
      Returns:
      true if handled, false otherwise.
    • readReply Link icon

      public void readReply(RESTfulReply reply, String data) throws IOException
      Called to format the request for this reply content, i.e. the accepted content.
      Specified by:
      readReply in interface IReplyContent
      Parameters:
      reply - The reply instance.
      data - The String data from the reply.
      Throws:
      IOException - For I/O errors.
    • getDocumentReply Link icon

      public Document getDocumentReply()
      Gets the reply document.
      Returns:
      The document.
    • canFormat Link icon

      public boolean canFormat()
      Checks if formatting the output is supported.
      Specified by:
      canFormat in interface IReplyContent
      Returns:
      true If formatting is supported.
    • getDescription Link icon

      public String getDescription()
      Gets the format description.
      Specified by:
      getDescription in interface IReplyContent
      Returns:
      The description string.
    • formatHTTPReply Link icon

      public String formatHTTPReply()
      Formats the URLConnection HTTP headers reply into a String.
      Specified by:
      formatHTTPReply in interface IReplyContent
      Returns:
      The formatted HTML reply string.
    • getRawOutput Link icon

      public String getRawOutput(boolean doFormat)
      Gets the raw text data from the reply.
      Specified by:
      getRawOutput in interface IReplyContent
      Parameters:
      doFormat - Flag to format the output (used for JSON and XML).
      Returns:
      The String of the reply, or null if an exception occurred.
    • getElementFromPath Link icon

      public Element getElementFromPath(String path)
      Gets an Element with specified path.
      Parameters:
      path - The path to look-up.
      Returns:
      The element found.
    • getStringFromPath Link icon

      public String getStringFromPath(String path)
      Gets the String reply data with specified path.
      Parameters:
      path - The path to look-up.
      Returns:
      The data, or null if not found.