Package com.squareup.okhttp
Class HttpHandler
- java.lang.Object
-
- java.net.URLStreamHandler
-
- com.squareup.okhttp.HttpHandler
-
- Direct Known Subclasses:
HttpsHandler
public class HttpHandler extends URLStreamHandler
-
-
Constructor Summary
Constructors Constructor Description HttpHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OkUrlFactorycreateHttpOkUrlFactory(Proxy proxy)Creates an OkHttpClient suitable for creatingHttpURLConnectioninstances on Android.protected intgetDefaultPort()Returns the default port of the protocol used by the handled URL.protected OkUrlFactorynewOkUrlFactory(Proxy proxy)protected URLConnectionopenConnection(URL url)Establishes a new connection to the resource specified by the URLu.protected URLConnectionopenConnection(URL url, Proxy proxy)Establishes a new connection to the resource specified by the URLuusing the givenproxy.-
Methods inherited from class java.net.URLStreamHandler
equals, getHostAddress, hashCode, hostsEqual, parseURL, sameFile, setURL, setURL, toExternalForm
-
-
-
-
Method Detail
-
openConnection
protected URLConnection openConnection(URL url) throws IOException
Description copied from class:URLStreamHandlerEstablishes a new connection to the resource specified by the URLu. Since different protocols also have unique ways of connecting, it must be overwritten by the subclass.- Specified by:
openConnectionin classURLStreamHandler- 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:URLStreamHandlerEstablishes a new connection to the resource specified by the URLuusing the givenproxy. Since different protocols also have unique ways of connecting, it must be overwritten by the subclass.- Overrides:
openConnectionin classURLStreamHandler- 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:URLStreamHandlerReturns the default port of the protocol used by the handled URL. The default implementation always returns-1.- Overrides:
getDefaultPortin classURLStreamHandler
-
newOkUrlFactory
protected OkUrlFactory newOkUrlFactory(Proxy proxy)
-
createHttpOkUrlFactory
public static OkUrlFactory createHttpOkUrlFactory(Proxy proxy)
Creates an OkHttpClient suitable for creatingHttpURLConnectioninstances on Android.
-
-