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
Constructors Constructor Description ObsoleteUrlFactory(okhttp3.OkHttpClient client)
Deprecated.Instantiates a new Obsolete url factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description okhttp3.OkHttpClient
client()
Deprecated.Client ok http client.ObsoleteUrlFactory
clone()
Deprecated.Returns a copy of this stream handler factory that includes a shallow copy of the internal HTTP client.URLStreamHandler
createURLStreamHandler(String protocol)
Deprecated.Creates a URLStreamHandler as aURL.setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)
.HttpURLConnection
open(URL url)
Deprecated.Open http url connection.ObsoleteUrlFactory
setClient(okhttp3.OkHttpClient client)
Deprecated.Sets client.
-
-
-
Method Detail
-
client
public okhttp3.OkHttpClient client()
Deprecated.Client ok http client.- Returns:
- the ok http client
-
setClient
public ObsoleteUrlFactory setClient(okhttp3.OkHttpClient client)
Deprecated.Sets client.- Parameters:
client
- the client- Returns:
- the client
-
clone
public ObsoleteUrlFactory clone()
Deprecated.Returns a copy of this stream handler factory that includes a shallow copy of the internal HTTP client.
-
open
public HttpURLConnection open(URL url)
Deprecated.Open http url connection.- Parameters:
url
- the url- Returns:
- the http url connection
-
createURLStreamHandler
public URLStreamHandler createURLStreamHandler(String protocol)
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
-
-