Interface IReplyContent

  • All Known Implementing Classes:
    JSONReply, TextReply, XMLReply

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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean canFormat()
      Checks if formatting the output is supported.
      java.lang.String formatHTTPReply()
      Formats the URLConnection HTTP headers reply into a String.
      java.lang.String getAcceptedContent()
      Gets the accepted contents.
      java.lang.String getDescription()
      Gets the format description.
      java.lang.String getRawOutput​(boolean format)
      Gets the raw text data from the reply.
      boolean isHandled​(java.lang.String type)
      Checks if a content type is handled by this reply.
      void readReply​(RESTfulReply reply, java.lang.String data)
      Called to format the request for this reply content, i.e.
    • Method Detail

      • getAcceptedContent

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

        boolean isHandled​(java.lang.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,
                       java.lang.String data)
                throws java.io.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:
        java.io.IOException - For I/O errors.
      • canFormat

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

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

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

        java.lang.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.