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
Modifier and Type Method Description protected intgetDefaultPort()Returns the default port of the protocol used by the handled URL.protected OkHttpClientnewOkHttpClient(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
-
Constructor Details
-
HttpHandler
public HttpHandler()
-
-
Method Details
-
openConnection
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
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
-
newOkHttpClient
-