Class HttpHandler

    • Constructor Detail

      • HttpHandler

        public HttpHandler()
    • Method Detail

      • openConnection

        protected URLConnection openConnection​(URL url)
                                        throws IOException
        Description copied from class: URLStreamHandler
        Establishes a new connection to the resource specified by the URL u. Since different protocols also have unique ways of connecting, it must be overwritten by the subclass.
        Specified by:
        openConnection in class URLStreamHandler
        Parameters:
        url - the URL to the resource where a connection has to be opened.
        Returns:
        the opened URLConnection to the specified resource.
        Throws:
        IOException - if an I/O error occurs during opening the connection.
      • openConnection

        protected URLConnection openConnection​(URL url,
                                               Proxy proxy)
                                        throws IOException
        Description copied from class: URLStreamHandler
        Establishes a new connection to the resource specified by the URL u using the given proxy. Since different protocols also have unique ways of connecting, it must be overwritten by the subclass.
        Overrides:
        openConnection in class URLStreamHandler
        Parameters:
        url - the URL to the resource where a connection has to be opened.
        proxy - the proxy that is used to make the connection.
        Returns:
        the opened URLConnection to the specified resource.
        Throws:
        IOException - if an I/O error occurs during opening the connection.
      • getDefaultPort

        protected int getDefaultPort()
        Description copied from class: URLStreamHandler
        Returns the default port of the protocol used by the handled URL. The default implementation always returns -1.
        Overrides:
        getDefaultPort in class URLStreamHandler
      • createHttpOkUrlFactory

        public static OkUrlFactory createHttpOkUrlFactory​(Proxy proxy)
        Creates an OkHttpClient suitable for creating HttpURLConnection instances on Android.