com.ibm.streamsx.rest.internal

Interface RestUtils



  • public interface RestUtils
    • Method Summary

      All Methods Static Methods Default Methods 
      Modifier and Type Method and Description
      static java.lang.String createBasicAuth(com.google.gson.JsonObject credentials)
      Create an encoded Basic auth header for the given credentials.
      static java.lang.String createBasicAuth(java.lang.String userName, java.lang.String authToken)
      Create an encoded Basic auth header for the given userName and authToken
      static java.lang.String createBearerAuth(java.lang.String tokenBase64)
      Create an encoded Bearer auth header for the given token.
      static org.apache.http.client.fluent.Executor createExecutor() 
      static org.apache.http.client.fluent.Executor createExecutor(boolean allowInsecure) 
      static org.apache.http.impl.client.CloseableHttpClient createHttpClient() 
      static org.apache.http.impl.client.CloseableHttpClient createHttpClient(boolean allowInsecure) 
      static com.google.gson.JsonObject getGsonResponse(org.apache.http.client.fluent.Executor executor, java.lang.String auth, java.lang.String url)
      Gets a JSON response to an HTTP GET call
      static com.google.gson.JsonObject getGsonResponse(org.apache.http.client.fluent.Executor executor, java.lang.String auth, java.net.URL url) 
      static com.google.gson.JsonObject gsonFromResponse(org.apache.http.HttpResponse response) 
      static com.google.gson.JsonObject requestGsonResponse(org.apache.http.client.fluent.Executor executor, org.apache.http.client.fluent.Request request)
      Gets a JSON response to an HTTP request call
    • Method Detail

      • createBasicAuth

        static java.lang.String createBasicAuth(com.google.gson.JsonObject credentials)
        Create an encoded Basic auth header for the given credentials.
        Parameters:
        credentials - Service credentials.
        Returns:
        the body of a Authentication: Basic header using the user and password contained in the credentials.
      • createBasicAuth

        static java.lang.String createBasicAuth(java.lang.String userName,
                                                java.lang.String authToken)
        Create an encoded Basic auth header for the given userName and authToken
        Parameters:
        userName - The user name for authentication
        authToken - The password for authentication
        Returns:
        the body of a Authentication: Basic header using the userName and authToken
      • createBearerAuth

        static java.lang.String createBearerAuth(java.lang.String tokenBase64)
        Create an encoded Bearer auth header for the given token.
        Parameters:
        tokenBase64 - An authentication token, expected to be already encoded in base64, as it is when returned from the IAM server
        Returns:
        the body of a Authentication: Bearer header using tokenBase64
      • createExecutor

        static org.apache.http.client.fluent.Executor createExecutor()
      • createExecutor

        static org.apache.http.client.fluent.Executor createExecutor(boolean allowInsecure)
      • createHttpClient

        static org.apache.http.impl.client.CloseableHttpClient createHttpClient()
      • createHttpClient

        static org.apache.http.impl.client.CloseableHttpClient createHttpClient(boolean allowInsecure)
      • getGsonResponse

        static com.google.gson.JsonObject getGsonResponse(org.apache.http.client.fluent.Executor executor,
                                                          java.lang.String auth,
                                                          java.lang.String url)
                                                   throws java.io.IOException
        Gets a JSON response to an HTTP GET call
        Parameters:
        executor - HTTP client executor to use for call
        auth - Authentication header contents, or null
        inputString - REST call to make
        Returns:
        response from the inputString
        Throws:
        java.io.IOException
      • getGsonResponse

        static com.google.gson.JsonObject getGsonResponse(org.apache.http.client.fluent.Executor executor,
                                                          java.lang.String auth,
                                                          java.net.URL url)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • requestGsonResponse

        static com.google.gson.JsonObject requestGsonResponse(org.apache.http.client.fluent.Executor executor,
                                                              org.apache.http.client.fluent.Request request)
                                                       throws java.io.IOException
        Gets a JSON response to an HTTP request call
        Throws:
        java.io.IOException
      • gsonFromResponse

        static com.google.gson.JsonObject gsonFromResponse(org.apache.http.HttpResponse response)
                                                    throws java.io.IOException
        Throws:
        java.io.IOException
streamsx.topology 1.16 @ IBMStreams GitHub