Interface JsonResponseParser

  • All Known Implementing Classes:
    SimpleJsonResponseParser

    public interface JsonResponseParser
    A parser that receives the MR subscriber response body and returns a list of strings. This class allows this distribution to remain JSON parser neutral without assuming that it's run in a J2EE environment.
    • Method Detail

      • parseResponseBody

        default void parseResponseBody​(okhttp3.ResponseBody httpBody,
                                       OnapMrFetchResponse fetchResponse)
                                throws IOException
        Parse the okhttp response body into the fetch response instance.
        Parameters:
        httpBody - the okhttp response body
        fetchResponse - the fetch response to populate
        Throws:
        IOException - if reading the body throws an IOException
      • parseResponseBody

        void parseResponseBody​(String httpBody,
                               OnapMrFetchResponse fetchResponse)
                        throws IOException
        Parse the string representation of a response body into the fetch response instance.

        Note: This method is only called by the ResponseBody version above. If you override that, this method does not need to be implemented beyond meeting the compiler requirement.
        Parameters:
        httpBody - the http body as a string
        fetchResponse - the fetch response to populate
        Throws:
        IOException - if reading the body throws an IOException