/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
@Override public HttpURLConnection openConnection(URL url) throws IOException { if (factory == null) { factory = new OkUrlFactory(clientBuilder.build()); } return factory.open(url); }
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; }
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); }
HttpURLConnection connection = new OkUrlFactory(TmmHttpClient.getHttpClient()).open(new URL(request)); connection.setDoOutput(true); connection.setDoInput(true);
Call c = new Call(methodName, params); HttpURLConnection http = new OkUrlFactory(client).open(url); http.setRequestProperty(USER_AGENT, userAgent); http.setRequestMethod(HTTP_POST);