use of io.jawg.osmcontributor.flickr.oauth.NoSSLv3SocketFactory in project osm-contributor by jawg.
the class FlickrPhotoUtils method getAdapter.
public static Retrofit getAdapter() {
if (adapter == null) {
try {
SSLSocketFactory noSSLv3Factory = new NoSSLv3SocketFactory(new URL(FLICKR_API_URL));
OkHttpClient okHttpClient = new OkHttpClient().newBuilder().sslSocketFactory(noSSLv3Factory).build();
adapter = new Retrofit.Builder().addConverterFactory(ScalarsConverterFactory.create()).baseUrl(FLICKR_API_URL).client(okHttpClient).build();
} catch (MalformedURLException e) {
} catch (IOException e) {
}
}
return adapter;
}
use of io.jawg.osmcontributor.flickr.oauth.NoSSLv3SocketFactory in project osm-contributor by jawg.
the class FlickrPhotoUtils method getAdapter.
public static Retrofit getAdapter(final Map<String, String> oAuthParams) {
Retrofit adapterOauth = null;
try {
SSLSocketFactory NoSSLv3Factory = new NoSSLv3SocketFactory(new URL(FLICKR_API_URL));
adapterOauth = new Retrofit.Builder().addConverterFactory(ScalarsConverterFactory.create()).baseUrl(FLICKR_API_URL).client(new OkHttpClient().newBuilder().sslSocketFactory(NoSSLv3Factory).addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Request newRequest = request.newBuilder().addHeader("Authorization", FlickrSecurityUtils.getAuthorizationHeader(oAuthParams)).build();
return chain.proceed(newRequest);
}
}).build()).build();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return adapterOauth;
}
use of io.jawg.osmcontributor.flickr.oauth.NoSSLv3SocketFactory in project osm-contributor by jawg.
the class FlickrUploadUtils method getRestAdapter.
public static Retrofit getRestAdapter(final Map<String, String> oAuthParams) {
if (adapter == null) {
try {
SSLSocketFactory NoSSLv3Factory = new NoSSLv3SocketFactory(new URL("https://up.flickr.com/services"));
adapter = new Retrofit.Builder().addConverterFactory(ScalarsConverterFactory.create()).baseUrl("https://up.flickr.com/services/").client(new okhttp3.OkHttpClient().newBuilder().sslSocketFactory(NoSSLv3Factory).addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Request newRequest = request.newBuilder().addHeader("Authorization", FlickrSecurityUtils.getAuthorizationHeader(oAuthParams)).build();
return chain.proceed(newRequest);
}
}).build()).build();
} catch (MalformedURLException e) {
} catch (IOException e) {
}
}
return adapter;
}
Aggregations