Interface IReplyContent

All Known Implementing Classes:
JSONReply, TextReply, XMLReply

public interface IReplyContent
Interface for processing of the reply content.
Author:
Christopher Mindus
  • Method Details

    • getAcceptedContent

      String getAcceptedContent()
      Gets the accepted contents.
      Returns:
      A String such as "text/html" or "text/plain, text/html".
    • isHandled

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

      void readReply(RESTfulReply reply, String data) throws IOException
      Called to format the request for this reply content, i.e. the accepted content.
      Parameters:
      reply - The reply instance.
      data - The String data from the reply.
      Throws:
      IOException - For I/O errors.
    • canFormat

      boolean canFormat()
      Checks if formatting the output is supported.
      Returns:
      true If formatting is supported.
    • getDescription

      String getDescription()
      Gets the format description.
      Returns:
      The description string.
    • formatHTTPReply

      String formatHTTPReply()
      Formats the URLConnection HTTP headers reply into a String.
      Returns:
      The formatted HTML reply string.
    • getRawOutput

      String getRawOutput(boolean format)
      Gets the raw text data from the reply.
      Parameters:
      format - Flag to format the output (used for JSON and XML).
      Returns:
      The String of the reply, or null if an exception occurred.