List of usage examples for com.squareup.okhttp HttpUrl parse
public static HttpUrl parse(String url)
From source file:com.granita.contacticloudsync.syncadapter.CalendarSyncManager.java
License:Open Source License
@Override protected void prepare() { collectionURL = HttpUrl.parse(localCalendar().getName()); davCollection = new DavCalendar(log, httpClient, collectionURL); }
From source file:com.granita.contacticloudsync.syncadapter.ContactsSyncManager.java
License:Open Source License
@Override protected void prepare() throws ContactsStorageException { // prepare local address book localCollection = new LocalAddressBook(account, provider); String url = localAddressBook().getURL(); if (url == null) throw new ContactsStorageException("Couldn't get address book URL"); collectionURL = HttpUrl.parse(url); davCollection = new DavAddressBook(log, httpClient, collectionURL); processChangedGroups();// w ww .ja va 2 s . c om }
From source file:com.granita.contacticloudsync.syncadapter.TasksSyncManager.java
License:Open Source License
@Override protected void prepare() { collectionURL = HttpUrl.parse(localTaskList().getSyncId()); davCollection = new DavCalendar(log, httpClient, collectionURL); }
From source file:com.greenhouseci.launchpad.dto.Project.java
License:Apache License
public String getProjectId() { String fragment = HttpUrl.parse(getWebUrl()).fragment(); return fragment.substring(fragment.lastIndexOf("/") + 1); }
From source file:com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVisionIntegrationTest.java
License:Open Source License
/** * Test get image from URL./*from w ww . ja v a2 s . co m*/ */ @Test public void testGetImageFromURL() { final ImageLink image = service.getImageLink(HttpUrl.parse("http://www.techcrunch.com/").url()); Assert.assertNotNull(image); }
From source file:com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVisionIntegrationTest.java
License:Open Source License
/** * Test get ranked image keywords from URL. *//*from w w w. ja v a2 s . c o m*/ @Test public void testGetRankedImageKeywordsFromURL() { final ImageKeywords image = service.getImageKeywords(HttpUrl.parse(BABY_IMAGE).url(), true, true); Assert.assertNotNull(image); }
From source file:com.ibm.watson.developer_cloud.alchemy.v1.AlchemyVisionIntegrationTest.java
License:Open Source License
/** * Test recognize faces from URL.//from w w w . j ava 2s . c o m */ @Test public void testRecognizeFacesFromURL() { final ImageFaces image = service.recognizeFaces(HttpUrl.parse(BABY_IMAGE).url(), false); Assert.assertNotNull(image); }
From source file:com.ibm.watson.developer_cloud.http.RequestBuilder.java
License:Open Source License
/** * Instantiates a new request.// w w w. j a v a 2 s .c om * * @param method the method, PUT, POST, GET or DELETE * @param url the request URL */ private RequestBuilder(HTTPMethod method, String url) { this.method = method; if (url == null) throw new IllegalArgumentException("url cannot be null"); // Since HttpUrl requires requires a http/s full url, add a default endpoint httpUrl = HttpUrl.parse(url); if (httpUrl == null) this.httpUrl = HttpUrl.parse(RequestUtil.DEFAULT_ENDPOINT + url); }
From source file:com.ibm.watson.developer_cloud.service.AlchemyService.java
License:Open Source License
/** * Adds the Alchemy API key to HTTP request. * // ww w . j a v a 2 s. c om * @param builder the builder * @param apiKey the API key token */ private void addApiKeyToRequest(Builder builder, String apiKey) { final HttpUrl url = HttpUrl.parse(builder.build().urlString()); if (url.query() == null || url.query().isEmpty()) { builder.url(builder.build().url() + "?" + apiKey); } else { builder.url(builder.build().url() + "&" + apiKey); } }
From source file:com.ibm.watson.developer_cloud.service.RequestBuilderTest.java
License:Open Source License
/** * Test using path url.// w ww . ja v a 2 s .c om */ @Test public void testUsingPathUrl() { final String url = "/v1/ping"; final Request request = RequestBuilder.get(url).build(); assertEquals("GET", request.method()); assertTrue(RequestUtil.isRelative(request)); assertEquals(url, HttpUrl.parse(request.urlString()).encodedPath()); }