本文整理了Java中com.squareup.okhttp.HttpUrl.parse()
方法的一些代码示例,展示了HttpUrl.parse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpUrl.parse()
方法的具体详情如下:
包路径:com.squareup.okhttp.HttpUrl
类名称:HttpUrl
方法名:parse
暂无
代码示例来源:origin: Javen205/IJPay
@Override
public String get(String url, Map<String, String> queryParas) {
com.squareup.okhttp.HttpUrl.Builder urlBuilder = com.squareup.okhttp.HttpUrl.parse(url).newBuilder();
for (Entry<String, String> entry : queryParas.entrySet()) {
urlBuilder.addQueryParameter(entry.getKey(), entry.getValue());
}
com.squareup.okhttp.HttpUrl httpUrl = urlBuilder.build();
com.squareup.okhttp.Request request = new com.squareup.okhttp.Request.Builder().url(httpUrl).get().build();
return exec(request);
}
代码示例来源:origin: liferay/liferay-mobile-sdk
@Override
public String encodeURL(String url) {
return HttpUrl.parse(url).toString();
}
代码示例来源:origin: blockchain/api-v1-client-java
private HttpUrl.Builder getHttpUrlBuilder(String baseURL, String resource) throws MalformedURLException {
HttpUrl url = HttpUrl.parse(baseURL);
if (url == null) {
throw new MalformedURLException();
}
HttpUrl.Builder urlBuilder = url.newBuilder();
urlBuilder.addPathSegment(resource);
return urlBuilder;
}
代码示例来源:origin: com.jfinal/jfinal-weixin
@Override
public String get(String url, Map<String, String> queryParas) {
com.squareup.okhttp.HttpUrl.Builder urlBuilder = com.squareup.okhttp.HttpUrl.parse(url).newBuilder();
for (Entry<String, String> entry : queryParas.entrySet()) {
urlBuilder.addQueryParameter(entry.getKey(), entry.getValue());
}
com.squareup.okhttp.HttpUrl httpUrl = urlBuilder.build();
com.squareup.okhttp.Request request = new com.squareup.okhttp.Request.Builder().url(httpUrl).get().build();
return exec(request);
}
代码示例来源:origin: com.github.javen205/IJPay
@Override
public String get(String url, Map<String, String> queryParas) {
com.squareup.okhttp.HttpUrl.Builder urlBuilder = com.squareup.okhttp.HttpUrl.parse(url).newBuilder();
for (Entry<String, String> entry : queryParas.entrySet()) {
urlBuilder.addQueryParameter(entry.getKey(), entry.getValue());
}
com.squareup.okhttp.HttpUrl httpUrl = urlBuilder.build();
com.squareup.okhttp.Request request = new com.squareup.okhttp.Request.Builder().url(httpUrl).get().build();
return exec(request);
}
代码示例来源:origin: com.netflix.spinnaker.clouddriver/clouddriver-artifacts
public InputStream download(Artifact artifact) throws IOException {
HttpUrl.Builder fileUrl;
try {
fileUrl = HttpUrl.parse(artifact.getReference()).newBuilder();
} catch (Exception e) {
throw new IllegalArgumentException("Malformed Bitbucket content URL in 'reference'. Read more here https://www.spinnaker.io/reference/artifacts/types/bitbucket-file/: " + e.getMessage(), e);
}
Request downloadRequest = requestBuilder
.url(artifact.getReference())
.build();
try {
Response downloadResponse = okHttpClient.newCall(downloadRequest).execute();
return downloadResponse.body().byteStream();
} catch (IOException e) {
throw new FailedDownloadException("Unable to download the contents of artifact " + artifact + ": " + e.getMessage(), e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch
@VisibleForTesting
void logSuccess(@Nullable String taskId) {
if (taskId == null) {
LOG.info("ANALYSIS SUCCESSFUL");
} else {
Map<String, String> metadata = new LinkedHashMap<>();
String effectiveKey = projectReactor.getRoot().getKeyWithBranch();
metadata.put("projectKey", effectiveKey);
metadata.put("serverUrl", publicUrl());
URL dashboardUrl = HttpUrl.parse(publicUrl()).newBuilder()
.addPathSegment("dashboard").addPathSegment("index").addPathSegment(effectiveKey)
.build()
.url();
metadata.put("dashboardUrl", dashboardUrl.toExternalForm());
URL taskUrl = HttpUrl.parse(publicUrl()).newBuilder()
.addPathSegment("api").addPathSegment("ce").addPathSegment("task")
.addQueryParameter("id", taskId)
.build()
.url();
metadata.put("ceTaskId", taskId);
metadata.put("ceTaskUrl", taskUrl.toExternalForm());
LOG.info("ANALYSIS SUCCESSFUL, you can browse {}", dashboardUrl);
LOG.info("Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report");
LOG.info("More about the report processing at {}", taskUrl);
dumpMetadata(metadata);
}
}
代码示例来源:origin: com.netflix.spinnaker.clouddriver/clouddriver-artifacts
public InputStream download(Artifact artifact) throws IOException {
HttpUrl.Builder fileUrl;
try {
// reference should use the Gitlab raw file download url: https://docs.gitlab.com/ee/api/repository_files.html#get-raw-file-from-repository
fileUrl = HttpUrl.parse(artifact.getReference()).newBuilder();
} catch (Exception e) {
throw new IllegalArgumentException("Malformed gitlab content URL in 'reference'. Read more here https://www.spinnaker.io/reference/artifacts/types/gitlab-file/: " + e.getMessage(), e);
}
String version = artifact.getVersion();
if (StringUtils.isEmpty(version)) {
log.info("No version specified for artifact {}, using 'master'.", version);
version = "master";
}
fileUrl.addQueryParameter("ref", version);
Request fileRequest = requestBuilder
.url(fileUrl.build().toString())
.build();
try {
Response downloadResponse = okHttpClient.newCall(fileRequest).execute();
return downloadResponse.body().byteStream();
} catch (IOException e) {
throw new com.netflix.spinnaker.clouddriver.artifacts.gitlab.GitlabArtifactCredentials.FailedDownloadException("Unable to download the contents of artifact " + artifact + ": " + e.getMessage(), e);
}
}
代码示例来源:origin: com.netflix.spinnaker.clouddriver/clouddriver-artifacts
public InputStream download(Artifact artifact) throws IOException {
HttpUrl.Builder metadataUrlBuilder;
try {
metadataUrlBuilder = HttpUrl.parse(artifact.getReference()).newBuilder();
} catch (Exception e) {
throw new IllegalArgumentException("Malformed github content URL in 'reference'. Read more here https://www.spinnaker.io/reference/artifacts/types/github-file/: " + e.getMessage(), e);
内容来源于网络,如有侵权,请联系作者删除!