congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
OkUrlFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
OkUrlFactory
in
okhttp3

Best Java code snippets using okhttp3.OkUrlFactory (Showing top 20 results out of 315)

origin: square/okhttp

/**
 * Returns a copy of this stream handler factory that includes a shallow copy of the internal
 * {@linkplain OkHttpClient HTTP client}.
 */
@Override public OkUrlFactory clone() {
 return new OkUrlFactory(client);
}
origin: square/okhttp

@Override protected URLConnection openConnection(URL url, Proxy proxy) {
 return open(url, proxy);
}
origin: square/okhttp

 /** Sets the response cache to be used to read and write cached responses. */
 public static void setResponseCache(OkUrlFactory okUrlFactory, ResponseCache responseCache) {
  OkHttpClient.Builder builder = okUrlFactory.client().newBuilder();
  if (responseCache instanceof OkCacheContainer) {
   // Avoid adding layers of wrappers. Rather than wrap the ResponseCache in yet another layer to
   // make the ResponseCache look like an InternalCache, we can unwrap the Cache instead.
   // This means that Cache stats will be correctly updated.
   OkCacheContainer okCacheContainer = (OkCacheContainer) responseCache;
   builder.cache(okCacheContainer.getCache());
  } else {
   builder.setInternalCache(responseCache != null ? new CacheAdapter(responseCache) : null);
  }
  okUrlFactory.setClient(builder.build());
 }
}
origin: cloudant/java-cloudant

@Override
public HttpURLConnection openConnection(URL url) throws IOException {
  if (factory == null) {
    factory = new OkUrlFactory(clientBuilder.build());
  }
  return factory.open(url);
}
origin: cloudant/java-cloudant

  @Override
  public void shutdown() {
    try {
      factory.client().dispatcher().executorService().shutdown();
      factory.client().dispatcher().executorService().awaitTermination(5, TimeUnit.MINUTES);
      // Evict all the connections
      factory.client().connectionPool().evictAll();
    } catch (InterruptedException e) {
      // Oh well; we were only trying to aggressively shutdown
    }
  }
}
origin: tinyMediaManager/tinyMediaManager

HttpURLConnection connection = new OkUrlFactory(TmmHttpClient.getHttpClient()).open(new URL(request));
connection.setDoOutput(true);
connection.setDoInput(true);
origin: square/okhttp

@Override protected URLConnection openConnection(URL url) {
 return open(url);
}
origin: org.tinymediamanager.plugins/scraper-opensubtitles

Call c = new Call(methodName, params);
HttpURLConnection http = new OkUrlFactory(client).open(url);
http.setRequestProperty(USER_AGENT, userAgent);
http.setRequestMethod(HTTP_POST);
origin: com.squareup.okhttp3/okhttp-urlconnection

/**
 * Returns a copy of this stream handler factory that includes a shallow copy of the internal
 * {@linkplain OkHttpClient HTTP client}.
 */
@Override public OkUrlFactory clone() {
 return new OkUrlFactory(client);
}
origin: com.squareup.okhttp3/okhttp-android-support

 /** Sets the response cache to be used to read and write cached responses. */
 public static void setResponseCache(OkUrlFactory okUrlFactory, ResponseCache responseCache) {
  OkHttpClient.Builder builder = okUrlFactory.client().newBuilder();
  if (responseCache instanceof OkCacheContainer) {
   // Avoid adding layers of wrappers. Rather than wrap the ResponseCache in yet another layer to
   // make the ResponseCache look like an InternalCache, we can unwrap the Cache instead.
   // This means that Cache stats will be correctly updated.
   OkCacheContainer okCacheContainer = (OkCacheContainer) responseCache;
   builder.cache(okCacheContainer.getCache());
  } else {
   builder.setInternalCache(responseCache != null ? new CacheAdapter(responseCache) : null);
  }
  okUrlFactory.setClient(builder.build());
 }
}
origin: square/okhttp

public HttpURLConnection open(URL url) {
 return open(url, client.proxy());
}
origin: com.github.ljun20160606/okhttp-urlconnection

/**
 * Returns a copy of this stream handler factory that includes a shallow copy of the internal
 * {@linkplain OkHttpClient HTTP client}.
 */
@Override public OkUrlFactory clone() {
 return new OkUrlFactory(client);
}
origin: kohsuke/github-api

  public HttpURLConnection connect(URL url) throws IOException {
    return urlFactory.open(url);
  }
}
origin: apache/servicemix-bundles

/**
 * Returns a copy of this stream handler factory that includes a shallow copy of the internal
 * {@linkplain OkHttpClient HTTP client}.
 */
@Override public OkUrlFactory clone() {
 return new OkUrlFactory(client);
}
origin: org.kohsuke/github-api

  public HttpURLConnection connect(URL url) throws IOException {
    return urlFactory.open(url);
  }
}
origin: fullcontact/fullcontact4j

public FCUrlClient(String userAgent, Map<String, String> customHeaders, OkHttpClient client, String apiKey) {
  okUrlFactory = new OkUrlFactory(client);
  if(customHeaders != null) {
    this.headers = customHeaders;
  }
  //disallow api key, token, or user agent headers to be supplied by the user
  boolean removedBlocked = headers.remove(FCConstants.HEADER_AUTH_API_KEY) != null;
  removedBlocked |= headers.remove(FCConstants.HEADER_AUTH_ACCESS_TOKEN) != null;
  if(removedBlocked) {
    Utils.info("Custom FullContact header for api key or access token was supplied. It has been ignored.");
  }
  this.userAgent = userAgent;
  this.apiKey = apiKey;
}
origin: com.github.ljun20160606/okhttp-urlconnection

@Override protected URLConnection openConnection(URL url) {
 return open(url);
}
origin: jenkins-infra/update-center2

private void retrieveRepositoryNames() throws IOException {
  System.err.println("Retrieving GitHub repository names...");
  Cache cache = new Cache(GITHUB_API_CACHE, 20L*1024*1024); // 20 MB cache
  github = new GitHubBuilder().withConnector(new OkHttp3Connector(new OkUrlFactory(new OkHttpClient.Builder().cache(cache).build()))).withPassword(GITHUB_API_USERNAME, GITHUB_API_PASSWORD).build();
  List<String> ret = new ArrayList<>();
  for (GHRepository repo : github.getOrganization("jenkinsci").listRepositories().withPageSize(100)) {
    ret.add(repo.getHtmlUrl().toString());
  }
  Files.write(GITHUB_REPO_LIST.toPath(), ret);
}
origin: apache/servicemix-bundles

@Override protected URLConnection openConnection(URL url, Proxy proxy) {
 return open(url, proxy);
}
origin: com.squareup.okhttp3/okhttp-urlconnection

@Override protected URLConnection openConnection(URL url, Proxy proxy) {
 return open(url, proxy);
}
okhttp3OkUrlFactory

Most used methods

  • <init>
  • open
  • client
  • setClient

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • setRequestProperty (URLConnection)
  • getApplicationContext (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Collectors (java.util.stream)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now