Class ObsoleteUrlFactory
java.lang.Object
org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory
- All Implemented Interfaces:
Cloneable
,URLStreamHandlerFactory
@Deprecated
public final class ObsoleteUrlFactory
extends Object
implements URLStreamHandlerFactory, Cloneable
Deprecated.
OkHttp 3.14 dropped support for the long-deprecated OkUrlFactory class, which allows you to use the HttpURLConnection
API with OkHttp's implementation. This class does the same thing using only public APIs in OkHttp. It requires OkHttp
3.14 or newer.
Rather than pasting this 1100 line gist into your source code, please upgrade to OkHttp's request/response API. Your code will be shorter, easier to read, and you'll be able to use interceptors.
-
Constructor Summary
ConstructorDescriptionObsoleteUrlFactory
(okhttp3.OkHttpClient client) Deprecated.Instantiates a new Obsolete url factory. -
Method Summary
Modifier and TypeMethodDescriptionokhttp3.OkHttpClient
client()
Deprecated.Client ok http client.clone()
Deprecated.Returns a copy of this stream handler factory that includes a shallow copy of the internal HTTP client.createURLStreamHandler
(String protocol) Deprecated.Creates a URLStreamHandler as aURL.setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)
.Deprecated.Open http url connection.setClient
(okhttp3.OkHttpClient client) Deprecated.Sets client.
-
Constructor Details
-
ObsoleteUrlFactory
public ObsoleteUrlFactory(okhttp3.OkHttpClient client) Deprecated.Instantiates a new Obsolete url factory.- Parameters:
client
- the client
-
-
Method Details
-
client
public okhttp3.OkHttpClient client()Deprecated.Client ok http client.- Returns:
- the ok http client
-
setClient
Deprecated.Sets client.- Parameters:
client
- the client- Returns:
- the client
-
clone
Deprecated.Returns a copy of this stream handler factory that includes a shallow copy of the internal HTTP client. -
open
Deprecated.Open http url connection.- Parameters:
url
- the url- Returns:
- the http url connection
-
createURLStreamHandler
Deprecated.Creates a URLStreamHandler as aURL.setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)
.This code configures OkHttp to handle all HTTP and HTTPS connections created with
URL.openConnection()
:{ @code OkHttpClient okHttpClient = new OkHttpClient(); URL.setURLStreamHandlerFactory(new ObsoleteUrlFactory(okHttpClient)); }
- Specified by:
createURLStreamHandler
in interfaceURLStreamHandlerFactory
-