/** * Sets a mock connection used to construct a connection manager for working against mocked REST interfaces. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='link'>{@doc juneau-rest-client.UnitTesting} * </ul> * * @param c The mock connection. * @return This object (for method chaining). */ public RestClientBuilder mockHttpConnection(MockHttpConnection c) { rootUrl("http://localhost"); return httpClientConnectionManager(new MockHttpClientConnectionManager(c)); }
/** * Sets a mock connection used to construct a connection manager for working against mocked REST interfaces. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='link'>{@doc juneau-rest-client.UnitTesting} * </ul> * * @param c The mock connection. * @return This object (for method chaining). */ public RestClientBuilder mockHttpConnection(MockHttpConnection c) { rootUrl("http://localhost"); return httpClientConnectionManager(new MockHttpClientConnectionManager(c)); }
/** * Sets a mock connection used to construct a connection manager for working against mocked REST interfaces. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='link'>{@doc juneau-rest-client.UnitTesting} * </ul> * * @param c The mock connection. * @return This object (for method chaining). */ public RestClientBuilder mockHttpConnection(MockHttpConnection c) { rootUrl("http://localhost"); return httpClientConnectionManager(new MockHttpClientConnectionManager(c)); }
.build(); this.restClient = RestClient.create() .rootUrl(rootUrl) .accept(APPLICATION_JSON.getMimeType()) .httpClient(httpclient, true)
try (RestClient rc = RestClient.create().json().rootUrl("http://localhost:" + port).build()) { PetStore ps = rc.getRemoteResource(PetStore.class);
try (RestClient rc = RestClient.create().json().rootUrl("http://localhost:" + port).build()) { PetStore ps = rc.getRemoteResource(PetStore.class);
private FullContact(FullContactConfiguration configuration) throws InstantiationException { this.configuration = configuration; this.parser = JsonParser.DEFAULT.builder() .ignoreUnknownBeanProperties(true) .build(); this.serializer = JsonSerializer.DEFAULT.builder() .trimEmptyCollections(true) .trimEmptyMaps(true) .build(); this.restClientBuilder = RestClient.create() .accept("application/json") .contentType("application/json") .disableAutomaticRetries() .disableCookieManagement() .disableRedirectHandling() .header("Authorization", "Bearer "+configuration.getToken()) .parser(parser) .serializer(serializer) .rootUrl(baseUrl()); this.restClient = restClientBuilder.build(); }