@CacheResult public String findCountry(final String ip) { Objects.requireNonNull(ip, "FreeGeoIp service can't resolve a country for a null IP."); for (int i = 0; i < 2; i++) { try { final Response response = webClient.reset() .path(ip) .query("access_key", "d01f0ef8992202ca4f8ccb468e2126a2") .accept(MediaType.APPLICATION_JSON_TYPE) .get(Response.class); if (response == null) { // not 100% sure it can happen but it does, that's why we have a small retry mechanism try { sleep(100); } catch (final InterruptedException e) { Thread.interrupted(); return null; } continue; } return response.getCountry_name(); } catch (final UncheckedException | WebApplicationException | ClientWebApplicationException/*no net*/ e) { return null; } } return null; }
authorizeClient.reset(); authorizeClient.to(data.getReplyTo(), false); if (authenticityCookie != null) {
authorizeClient.reset(); authorizeClient.to(data.getReplyTo(), false); if (authenticityCookie != null) {
wc.reset().accept(MediaType.APPLICATION_JSON); for (Person person : persons) { wc.reset().accept(MediaType.APPLICATION_XML); wc.path("4"); getPerson(wc); wc.reset().accept(MediaType.APPLICATION_XML); wc.path("4"); wc.reset().accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML); Response response = wc.path("4").path("children").post(child); wc.reset().path("find").accept(MediaType.APPLICATION_XML); WebClient.getConfig(wc).getRequestContext().put("use.async.http.conduit", true); String patch = wc.reset().invoke("PATCH", null, String.class); System.out.println("Patch: " + patch);
wc.reset().accept(MediaType.APPLICATION_XML); wc.path("personinfo");
@org.junit.Test public void testRegisterClientInitialAccessTokenCodeGrant() throws Exception { URL busFile = OIDCDynamicRegistrationTest.class.getResource("client.xml"); String address = "https://localhost:" + PORT + "/services/dynamicWithAt/register"; WebClient wc = WebClient.create(address, Collections.singletonList(new JsonMapObjectProvider()), busFile.toString()); wc.accept("application/json").type("application/json"); ClientRegistration reg = newClientRegistrationCodeGrant(); ClientRegistrationResponse resp = null; assertEquals(401, wc.post(reg).getStatus()); wc.authorization(new ClientAccessToken("Bearer", "123456789")); resp = wc.post(reg, ClientRegistrationResponse.class); assertNotNull(resp.getClientId()); assertNotNull(resp.getClientSecret()); assertEquals(address + "/" + resp.getClientId(), resp.getRegistrationClientUri()); String regAccessToken = resp.getRegistrationAccessToken(); assertNotNull(regAccessToken); wc.reset(); wc.path(resp.getClientId()); assertEquals(401, wc.get().getStatus()); wc.authorization(new ClientAccessToken("Bearer", regAccessToken)); ClientRegistration clientRegResp = wc.get(ClientRegistration.class); testCommonRegCodeGrantProperties(clientRegResp); assertNull(clientRegResp.getTokenEndpointAuthMethod()); assertEquals(200, wc.delete().getStatus()); }
assertNotNull(regAccessToken); wc.reset(); wc.path(resp.getClientId()); assertEquals(401, wc.get().getStatus());
assertNotNull(regAccessToken); wc.reset(); wc.path(resp.getClientId());
assertNotNull(regAccessToken); wc.reset(); wc.path(resp.getClientId());