Skip to content

Commit 5b672bd

Browse files
committed
Javadoc update
1 parent 0a286ea commit 5b672bd

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

client/src/main/java/io/avaje/http/client/HttpClientContext.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
*
1414
* HttpClientContext ctx = HttpClientContext.newBuilder()
1515
* .withBaseUrl("http://localhost:8080")
16+
* .withRequestListener(new RequestLogger())
1617
* .withBodyAdapter(new JacksonBodyAdapter(new ObjectMapper()))
1718
* .build();
1819
*
1920
* HelloDto dto = ctx.request()
2021
* .path("hello")
2122
* .queryParam("name", "Rob")
2223
* .queryParam("say", "Ki ora")
23-
* .get()
24+
* .GET()
2425
* .bean(HelloDto.class);
2526
*
2627
* }</pre>
@@ -34,12 +35,13 @@ public interface HttpClientContext {
3435
*
3536
* HttpClientContext ctx = HttpClientContext.newBuilder()
3637
* .withBaseUrl("http://localhost:8080")
38+
* .withRequestListener(new RequestLogger())
3739
* .withBodyAdapter(new JacksonBodyAdapter(new ObjectMapper()))
3840
* .build();
3941
*
4042
* HttpResponse<String> res = ctx.request()
4143
* .path("hello")
42-
* .get().asString();
44+
* .GET().asString();
4345
*
4446
* }</pre>
4547
*/
@@ -118,14 +120,15 @@ static HttpClientContext.Builder newBuilder() {
118120
*
119121
* HttpClientContext ctx = HttpClientContext.newBuilder()
120122
* .withBaseUrl("http://localhost:8080")
123+
* .withRequestListener(new RequestLogger())
121124
* .withBodyAdapter(new JacksonBodyAdapter(new ObjectMapper()))
122125
* .build();
123126
*
124127
* HelloDto dto = ctx.request()
125128
* .path("hello")
126129
* .queryParam("name", "Rob")
127130
* .queryParam("say", "Ki ora")
128-
* .get()
131+
* .GET()
129132
* .bean(HelloDto.class);
130133
*
131134
* }</pre>
@@ -227,13 +230,14 @@ interface Builder {
227230
*
228231
* HttpClientContext ctx = HttpClientContext.newBuilder()
229232
* .withBaseUrl("http://localhost:8080")
233+
* .withRequestListener(new RequestLogger())
230234
* .withBodyAdapter(new JacksonBodyAdapter(new ObjectMapper()))
231235
* .build();
232236
*
233237
* HelloDto dto = ctx.request()
234238
* .path("hello")
235239
* .queryParam("say", "Ki ora")
236-
* .get()
240+
* .GET()
237241
* .bean(HelloDto.class);
238242
*
239243
* }</pre>

client/src/main/java/io/avaje/http/client/HttpClientRequest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
*
2020
* HelloDto dto = clientContext.request()
2121
* .path("hello").queryParam("name", "Rob").queryParam("say", "Ki ora")
22-
* .get().bean(HelloDto.class);
22+
* .GET()
23+
* .bean(HelloDto.class);
2324
*
2425
* }</pre>
2526
*
@@ -92,7 +93,8 @@ public interface HttpClientRequest {
9293
* HttpResponse<String> res = clientContext.request()
9394
* .url("http://127.0.0.1:8887")
9495
* .path("hello")
95-
* .get().asString();
96+
* .GET()
97+
* .asString();
9698
*
9799
* }</pre>
98100
*

client/src/main/java/io/avaje/http/client/RequestLogger.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,27 @@
1212

1313
/**
1414
* Logs request and response details for debug logging purposes.
15+
* <p>
16+
* This implementation logs the request and response with the same
17+
* single logging entry rather than separate logging of the request
18+
* and response.
1519
*/
1620
public class RequestLogger implements RequestListener {
1721

1822
private static final Logger log = LoggerFactory.getLogger(RequestLogger.class);
1923

2024
private final String delimiter;
2125

26+
/**
27+
* Create using the {@literal \n} new line character.
28+
*/
2229
public RequestLogger() {
2330
this("\n");
2431
}
2532

33+
/**
34+
* Create with a given line delimiter.
35+
*/
2636
public RequestLogger(String delimiter) {
2737
this.delimiter = delimiter;
2838
}

client/src/main/java/io/avaje/http/client/SimpleRetryHandler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public class SimpleRetryHandler implements RetryHandler {
1515
private final int maxRetries;
1616
private final long backoffMillis;
1717

18+
/**
19+
* Create with maximum number of retries and linear backoff time.
20+
*
21+
* @param maxRetries The maximum number of retry attempts
22+
* @param backoffMillis The linear backoff between attempts in milliseconds
23+
*/
1824
public SimpleRetryHandler(int maxRetries, long backoffMillis) {
1925
this.maxRetries = maxRetries;
2026
this.backoffMillis = backoffMillis;

client/src/main/java/io/avaje/http/client/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* HelloDto dto = ctx.request()
1515
* .path("hello")
1616
* .queryParam("say", "Ki ora")
17-
* .get()
17+
* .GET()
1818
* .bean(HelloDto.class);
1919
*
2020
* }</pre>

0 commit comments

Comments
 (0)