Module aeonics.core
Package aeonics.util

Class Http


  • public class Http
    extends java.lang.Object
    Simple http request fetcher. The result is returned as data. If the response mime type was application/json, then it is automatically decoded.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Http.Error
      Represents an HTTP Error code with possibly a body response.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Data get​(java.lang.String url)
      Fetches the specified resource using GET
      static Data get​(java.lang.String url, Data queryString)
      Fetches the specified resource using GET
      static Data get​(java.lang.String url, Data queryString, Data headers)
      Fetches the specified resource using GET
      static Data get​(java.lang.String url, Data queryString, Data headers, java.lang.String method)
      Fetches the specified resource using the provided method
      static Data post​(java.lang.String url)
      Fetches the specified resource using POST
      static Data post​(java.lang.String url, Data body)
      Fetches the specified resource using POST
      static Data post​(java.lang.String url, Data body, Data headers)
      Fetches the specified resource using POST
      static Data post​(java.lang.String url, Data body, Data headers, java.lang.String method)
      Fetches the specified resource using the provided method
      • Methods inherited from class java.lang.Object

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

      • post

        public static Data post​(java.lang.String url)
        Fetches the specified resource using POST
        Parameters:
        url - the url
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)
      • post

        public static Data post​(java.lang.String url,
                                Data body)
        Fetches the specified resource using POST
        Parameters:
        url - the url
        body - the content to send in key/value pairs
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)
      • post

        public static Data post​(java.lang.String url,
                                Data body,
                                Data headers)
        Fetches the specified resource using POST
        Parameters:
        url - the url
        body - the content to send in key/value pairs
        headers - the http request headers
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)
      • post

        public static Data post​(java.lang.String url,
                                Data body,
                                Data headers,
                                java.lang.String method)
        Fetches the specified resource using the provided method
        Parameters:
        url - the url
        body - the content to send in key/value pairs
        headers - the http request headers
        method - the http method
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)
      • get

        public static Data get​(java.lang.String url)
        Fetches the specified resource using GET
        Parameters:
        url - the url
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)
      • get

        public static Data get​(java.lang.String url,
                               Data queryString)
        Fetches the specified resource using GET
        Parameters:
        url - the url
        queryString - the content to append to the url in key/value pairs
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)
      • get

        public static Data get​(java.lang.String url,
                               Data queryString,
                               Data headers)
        Fetches the specified resource using GET
        Parameters:
        url - the url
        queryString - the content to append to the url in key/value pairs
        headers - the http request headers
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)
      • get

        public static Data get​(java.lang.String url,
                               Data queryString,
                               Data headers,
                               java.lang.String method)
        Fetches the specified resource using the provided method
        Parameters:
        url - the url
        queryString - the content to append to the url in key/value pairs
        headers - the http request headers
        method - the http method
        Returns:
        the response
        Throws:
        Http.Error - if the remote endpoint returns an error (http code 400+)