Class HttpResponse


  • public class HttpResponse
    extends java.lang.Object
    Utility class to hold HttpURLConnection and parse JSON response data.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.net.HttpURLConnection connection
      Variable to hold HttpURLConnection
      java.io.IOException readException
      Variable for holding IOExceptions
      byte[] response
      Varialbe to hold URL response
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpResponse​(java.net.HttpURLConnection connection)
      Reads response from HttpUrlConnection.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.json.JsonObject getJsonObject()
      Parse response into JsonObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • connection

        public final java.net.HttpURLConnection connection
        Variable to hold HttpURLConnection
      • readException

        public final java.io.IOException readException
        Variable for holding IOExceptions
      • response

        public final byte[] response
        Varialbe to hold URL response
    • Constructor Detail

      • HttpResponse

        public HttpResponse​(java.net.HttpURLConnection connection)
                     throws java.lang.Exception
        Reads response from HttpUrlConnection.
        Parameters:
        connection - HttpURLConnection to read
        Throws:
        java.lang.Exception - exception if errors
    • Method Detail

      • getJsonObject

        public javax.json.JsonObject getJsonObject()
                                            throws java.lang.Exception
        Parse response into JsonObject.
        Returns:
        parsed JsonObject
        Throws:
        java.lang.Exception - if unable to parse.