本文整理了Java中com.squareup.okhttp.HttpUrl.toString()
方法的一些代码示例,展示了HttpUrl.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpUrl.toString()
方法的具体详情如下:
包路径:com.squareup.okhttp.HttpUrl
类名称:HttpUrl
方法名:toString
暂无
代码示例来源:origin: google/data-transfer-project
@Test
public void testExport() throws Exception {
server.enqueue(new MockResponse().setBody(CALENDARS_RESPONSE));
server.enqueue(new MockResponse().setBody(CALENDAR1_EVENTS_RESPONSE));
server.enqueue(new MockResponse().setBody(CALENDAR2_EVENTS_RESPONSE));
server.start();
HttpUrl baseUrl = server.url("");
MicrosoftCalendarExporter exporter =
new MicrosoftCalendarExporter(baseUrl.toString(), client, mapper, transformerService);
ExportResult<CalendarContainerResource> resource = exporter
.export(UUID.randomUUID(), token, Optional.empty());
CalendarContainerResource calendarResource = resource.getExportedData();
Assert.assertEquals(2, calendarResource.getCalendars().size());
Assert.assertFalse(
calendarResource
.getCalendars()
.stream()
.anyMatch(c -> "Calendar1".equals(c.getId()) && "Calendar2".equals(c.getId())));
Assert.assertEquals(2, calendarResource.getEvents().size());
Assert.assertFalse(
calendarResource
.getEvents()
.stream()
.anyMatch(
e ->
"Test Appointment 1".equals(e.getTitle())
&& "Test Appointment 2".equals(e.getTitle())));
}
代码示例来源:origin: google/data-transfer-project
MicrosoftCalendarImporter importer =
new MicrosoftCalendarImporter(
baseUrl.toString(), client, mapper, transformerService, jobStore);
代码示例来源:origin: google/data-transfer-project
MicrosoftPhotosExporter exporter = new MicrosoftPhotosExporter(baseUrl.toString(), client,
mapper, jobStore);
代码示例来源:origin: com.github.simonpercic/oklog-java
@Override protected String requestUrl(Request request) {
return request.httpUrl().toString();
}
代码示例来源:origin: liferay/liferay-mobile-sdk
@Override
public String encodeURL(String url) {
return HttpUrl.parse(url).toString();
}
代码示例来源:origin: org.hobsoft.microbrowser/microbrowser-tck
public static String url(MockWebServer server, String path)
{
return server.url(path).toString();
}
代码示例来源:origin: com.github.simonpercic/oklog-java
@Override protected String responseUrl(Response response) {
return response.request().httpUrl().toString();
}
代码示例来源: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
.url(metadataUrlBuilder.build().toString())
.build();
代码示例来源:origin: plivo/plivo-java
@Before
public void setUp() throws Exception {
server = new MockWebServer();
server.start();
PlivoClient.BASE_URL = server.url("/").toString();
Plivo.init(authId, authToken);
Plivo.getClient().setTesting(true);
}
代码示例来源:origin: appnexus/mobile-sdk-android
@Before
public void setup() {
Robolectric.getBackgroundThreadScheduler().reset();
Robolectric.getForegroundThreadScheduler().reset();
ShadowLog.stream = System.out;
activity = Robolectric.buildActivity(MockMainActivity.class).create().start().resume().visible().get();
shadowOf(activity).grantPermissions("android.permission.INTERNET");
server= new MockWebServer();
try {
server.start();
HttpUrl url= server.url("/");
UTConstants.REQUEST_BASE_URL_UT = url.toString();
System.out.println(UTConstants.REQUEST_BASE_URL_UT);
ShadowSettings.setTestURL(url.toString());
TestResponsesUT.setTestURL(url.toString());
} catch (IOException e) {
System.out.print("IOException");
}
bgScheduler = Robolectric.getBackgroundThreadScheduler();
uiScheduler = Robolectric.getForegroundThreadScheduler();
Robolectric.flushBackgroundThreadScheduler();
Robolectric.flushForegroundThreadScheduler();
bgScheduler.pause();
uiScheduler.pause();
}
代码示例来源:origin: appnexus/mobile-sdk-android
@Before
public void setup() {
Robolectric.getBackgroundThreadScheduler().reset();
Robolectric.getForegroundThreadScheduler().reset();
ShadowLog.stream = System.out;
activity = Robolectric.buildActivity(MockMainActivity.class).create().start().resume().visible().get();
shadowOf(activity).grantPermissions("android.permission.INTERNET");
server= new MockWebServer();
try {
server.start();
HttpUrl url= server.url("/");
UTConstants.REQUEST_BASE_URL_UT = url.toString();
System.out.println(UTConstants.REQUEST_BASE_URL_UT);
ShadowSettings.setTestURL(url.toString());
} catch (IOException e) {
System.out.print("IOException");
}
bgScheduler = Robolectric.getBackgroundThreadScheduler();
uiScheduler = Robolectric.getForegroundThreadScheduler();
Robolectric.flushBackgroundThreadScheduler();
Robolectric.flushForegroundThreadScheduler();
bgScheduler.pause();
uiScheduler.pause();
}
内容来源于网络,如有侵权,请联系作者删除!