Class StandardHttpRequestor

    • Field Detail

      • INSTANCE

        public static final StandardHttpRequestor INSTANCE
        A thread-safe instance of StandardHttpRequestor that connects directly (as opposed to using a proxy).
    • Constructor Detail

      • StandardHttpRequestor

        public StandardHttpRequestor​(StandardHttpRequestor.Config config)
        Creates an instance that connects through the given proxy.
    • Method Detail

      • startPost

        public com.dropbox.core.http.StandardHttpRequestor.Uploader startPost​(java.lang.String url,
                                                                              java.lang.Iterable<HttpRequestor.Header> headers)
                                                                       throws java.io.IOException
        Specified by:
        startPost in class HttpRequestor
        Throws:
        java.io.IOException
      • startPostInStreamingMode

        public com.dropbox.core.http.StandardHttpRequestor.Uploader startPostInStreamingMode​(java.lang.String url,
                                                                                             java.lang.Iterable<HttpRequestor.Header> headers)
                                                                                      throws java.io.IOException
        Overrides:
        startPostInStreamingMode in class HttpRequestor
        Throws:
        java.io.IOException
      • startPut

        public com.dropbox.core.http.StandardHttpRequestor.Uploader startPut​(java.lang.String url,
                                                                             java.lang.Iterable<HttpRequestor.Header> headers)
                                                                      throws java.io.IOException
        Specified by:
        startPut in class HttpRequestor
        Throws:
        java.io.IOException
      • configureConnection

        @Deprecated
        protected void configureConnection​(javax.net.ssl.HttpsURLConnection conn)
                                    throws java.io.IOException
        Deprecated.
        Can be overridden to configure the underlying HttpsURLConnection used to make network requests. If you override this method, you should probably call super.configureConnection(conn) in your overridden method.
        Throws:
        java.io.IOException
      • configure

        protected void configure​(java.net.HttpURLConnection conn)
                          throws java.io.IOException
        Can be overriden to configure the underlying HttpURLConnection used to make network requests using https. Typically the connection will be a HttpsURLConnection, but that is dependent on the Java runtime. Care should be taken when casting the connection (check your JRE).

        If you are using Google App Engine, configure your DbxRequestConfig to use GoogleAppEngineRequestor as its default HttpRequestor. If you use StandardHttpRequestor in Google App Engine, SSL certificates may not be validated and your app will susceptible to Man-in-the-Middle attacks.

        Parameters:
        conn - URL connection object returned after creating an https network request.
        Throws:
        java.io.IOException
      • interceptResponse

        protected void interceptResponse​(java.net.HttpURLConnection conn)
                                  throws java.io.IOException
        Called before returning HttpRequestor.Response from a request.

        This method should be used by subclasses to add any logging, analytics, or cleanup necessary. Note that the connection response code and response streams will already be fetched before calling this method. This means any IOException from reading the response should already have occurred before this method is called.

        Do not consume the response or error streams in this method.

        Parameters:
        conn - HTTP URL connection
        Throws:
        java.io.IOException