public void requestExamples() { // #ws-holder WSRequest request = ws.url("http://example.com"); // #ws-holder // #ws-complex-holder WSRequest complexRequest = request .setHeader("headerKey", "headerValue") .setRequestTimeout(1000) .setQueryParameter("paramKey", "paramValue"); // #ws-complex-holder // #ws-get CompletionStage<WSResponse> responsePromise = complexRequest.get(); // #ws-get String url = "http://example.com"; // #ws-auth ws.url(url).setAuth("user", "password", WSAuthScheme.BASIC).get(); // #ws-auth // #ws-follow-redirects ws.url(url).setFollowRedirects(true).get(); // #ws-follow-redirects // #ws-query-parameter ws.url(url).setQueryParameter("paramKey", "paramValue"); // #ws-query-parameter // #ws-header ws.url(url).setHeader("headerKey", "headerValue").get(); // #ws-header String jsonString = "{\"key1\":\"value1\"}"; // #ws-header-content-type ws.url(url).setHeader("Content-Type", "application/json").post(jsonString); // OR ws.url(url).setContentType("application/json").post(jsonString); // #ws-header-content-type // #ws-timeout ws.url(url).setRequestTimeout(1000).get(); // #ws-timeout // #ws-post-form-data ws.url(url) .setContentType("application/x-www-form-urlencoded") .post("key1=value1&key2=value2"); // #ws-post-form-data // #ws-post-json JsonNode json = Json.newObject().put("key1", "value1").put("key2", "value2"); ws.url(url).post(json); // #ws-post-json String value = IntStream.range(0, 100).boxed().map(i -> "abcdefghij").reduce("", (a, b) -> a + b); ByteString seedValue = ByteString.fromString(value); Stream<ByteString> largeSource = IntStream.range(0, 10).boxed().map(i -> seedValue); Source<ByteString, ?> largeImage = Source.from(largeSource.collect(Collectors.toList())); // #ws-stream-request CompletionStage<WSResponse> wsResponse = ws.url(url).setBody(largeImage).execute("PUT"); // #ws-stream-request }