Class HttpGateway


  • public abstract class HttpGateway
    extends java.lang.Object
    Utility methods for handling HTTP requests.
    Author:
    Sylvain Hall�
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String s_userAgent  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String sendGet​(java.lang.String url)
      Sends a GET request to a specified URL
      static java.lang.String sendPost​(java.lang.String url, java.lang.String payload)
      Sends a POST request to a specified URL
      • Methods inherited from class java.lang.Object

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

      • s_userAgent

        public static final transient java.lang.String s_userAgent
        See Also:
        Constant Field Values
    • Method Detail

      • sendGet

        public static java.lang.String sendGet​(java.lang.String url)
                                        throws java.io.IOException
        Sends a GET request to a specified URL
        Parameters:
        url - The URL
        Returns:
        The string of the HTTP response
        Throws:
        java.io.IOException - If something goes wrong with the request
      • sendPost

        public static java.lang.String sendPost​(java.lang.String url,
                                                java.lang.String payload)
                                         throws java.io.IOException
        Sends a POST request to a specified URL
        Parameters:
        url - The URL
        payload - The request's payload
        Returns:
        The string of the HTTP response
        Throws:
        java.io.IOException - If something goes wrong with the request