Class HttpHandler

java.lang.Object
java.net.URLStreamHandler
com.squareup.okhttp.HttpHandler
Direct Known Subclasses:
HttpsHandler

public class HttpHandler
extends URLStreamHandler
  • Constructor Details

    • HttpHandler

      public HttpHandler()
  • Method Details

    • 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
    • newOkHttpClient

      protected OkHttpClient newOkHttpClient​(Proxy proxy)