Class ControllerTransport

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class ControllerTransport
    extends java.lang.Object
    implements java.lang.AutoCloseable
    • Constructor Detail

      • ControllerTransport

        public ControllerTransport​(java.util.Optional<SSLFactory> sslFactory)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • request

        public <T extends ControllerResponse> T request​(java.lang.String controllerUrl,
                                                        ControllerRoute route,
                                                        QueryParams params,
                                                        java.lang.Class<T> responseType)
                                                 throws java.util.concurrent.ExecutionException,
                                                        java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • request

        public <T extends ControllerResponse> T request​(java.lang.String controllerUrl,
                                                        ControllerRoute route,
                                                        QueryParams params,
                                                        java.lang.Class<T> responseType,
                                                        int timeoutMs,
                                                        byte[] data)
                                                 throws java.util.concurrent.ExecutionException,
                                                        java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • executeGet

        public <T extends ControllerResponse> T executeGet​(java.lang.String controllerUrl,
                                                           java.lang.String path,
                                                           QueryParams params,
                                                           java.lang.Class<T> responseType)
                                                    throws java.util.concurrent.ExecutionException,
                                                           java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • executeGet

        public <T extends ControllerResponse> T executeGet​(java.lang.String controllerUrl,
                                                           java.lang.String path,
                                                           QueryParams params,
                                                           java.lang.Class<T> responseType,
                                                           int timeoutMs)
                                                    throws java.util.concurrent.ExecutionException,
                                                           java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • executePost

        public <T extends ControllerResponse> T executePost​(java.lang.String controllerUrl,
                                                            java.lang.String path,
                                                            QueryParams params,
                                                            java.lang.Class<T> responseType)
                                                     throws java.util.concurrent.ExecutionException,
                                                            java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • executePost

        public <T extends ControllerResponse> T executePost​(java.lang.String controllerUrl,
                                                            java.lang.String path,
                                                            QueryParams params,
                                                            java.lang.Class<T> responseType,
                                                            int timeoutMs)
                                                     throws java.util.concurrent.ExecutionException,
                                                            java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • executePost

        public <T extends ControllerResponse> T executePost​(java.lang.String controllerUrl,
                                                            java.lang.String path,
                                                            QueryParams params,
                                                            java.lang.Class<T> responseType,
                                                            int timeoutMs,
                                                            byte[] data)
                                                     throws java.util.concurrent.TimeoutException,
                                                            java.util.concurrent.ExecutionException
        This method shoves the POST string query params into the URL so the body will only contain the byte array data to make processing/deserializing easier. Please make sure the query params doesn't exceed the URL limit of 2048 chars.
        Throws:
        java.util.concurrent.TimeoutException
        java.util.concurrent.ExecutionException
      • executeRequest

        protected <T extends ControllerResponse> T executeRequest​(org.apache.http.client.methods.HttpRequestBase request,
                                                                  java.lang.Class<T> responseType,
                                                                  int timeoutMs)
                                                           throws java.util.concurrent.ExecutionException,
                                                                  java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException