File tree Expand file tree Collapse file tree 9 files changed +106
-147
lines changed Expand file tree Collapse file tree 9 files changed +106
-147
lines changed Original file line number Diff line number Diff line change 54
54
<module >generator-core</module >
55
55
<module >generator-javalin</module >
56
56
<module >generator-helidon</module >
57
- <module >tests</module >
58
- <module >generator-client</module >
57
+ <!-- <module>tests</module> -- >
58
+ <!-- <module>generator-client</module> -- >
59
59
</modules >
60
60
61
61
</project >
Original file line number Diff line number Diff line change 16
16
<dependencies >
17
17
18
18
<dependency >
19
- <groupId >io.dinject</groupId >
20
- <artifactId >dinject-controller</artifactId >
21
- <version >1.21</version >
19
+ <groupId >org.avaje.composite</groupId >
20
+ <artifactId >logback</artifactId >
21
+ <version >1.1</version >
22
+ </dependency >
23
+
24
+ <dependency >
25
+ <groupId >io.avaje</groupId >
26
+ <artifactId >avaje-http-client</artifactId >
27
+ <version >0.1</version >
22
28
</dependency >
23
29
24
30
<dependency >
25
- <groupId >io.avaje.rs</groupId >
26
- <artifactId >client</artifactId >
27
- <version >0.1-SNAPSHOT</version >
31
+ <groupId >com.fasterxml.jackson.core</groupId >
32
+ <artifactId >jackson-databind</artifactId >
33
+ <version >2.11.2</version >
34
+ </dependency >
35
+
36
+ <dependency >
37
+ <groupId >io.dinject</groupId >
38
+ <artifactId >dinject-controller</artifactId >
39
+ <version >1.21</version >
28
40
</dependency >
29
41
30
42
<dependency >
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package org .example ;
2
+
3
+ import io .avaje .http .client .HttpClientContext ;
4
+ import io .dinject .controller .QueryParam ;
5
+
6
+ import java .util .List ;
7
+
8
+
9
+ public class Simple$httpclient implements Simple {
10
+
11
+ final HttpClientContext clientContext ;
12
+
13
+ public Simple$httpclient (HttpClientContext clientContext ) {
14
+ this .clientContext = clientContext ;
15
+ }
16
+
17
+ //@Get("users/{user}/repos")
18
+ @ Override
19
+ public List <Repo > listRepos (String user , @ QueryParam ("foo-too" ) String fooToo ) {
20
+ return clientContext .request ()
21
+ .path ("users" ).path (user ).path ("repos" ).param ("foo-too" , fooToo )
22
+ .get ()
23
+ .list (Repo .class );
24
+ }
25
+
26
+ }
Original file line number Diff line number Diff line change 3
3
4
4
import io .dinject .controller .Get ;
5
5
6
- import java .io .IOException ;
7
- import java .io .InputStream ;
8
- import java .net .http .HttpResponse ;
9
- import java .nio .file .Path ;
10
6
import java .util .List ;
11
- import java .util .function .Consumer ;
12
- import java .util .stream .Stream ;
13
7
14
8
public interface Simple {
15
9
16
-
17
10
@ Get ("users/{user}/repos" )
18
- List <Repo > listRepos (String user , String other ) throws IOException , InterruptedException ;
19
-
20
- @ Get ("users/{id}" )
21
- Repo getById (String id );
22
- //Call<List<Repo>> listRepos(@Path("user") String user);
23
-
24
- @ Get ("users/{id}" )
25
- HttpResponse <Repo > getById2 (String id );
26
-
27
- @ Get ("users/{id}" )
28
- void readUsing (String id , Consumer <Stream <String >> consumer );
29
-
30
- @ Get ("dwn/{id}" )
31
- void downloadMe (String id , Consumer <InputStream > file );
11
+ List <Repo > listRepos (String user , String other );
32
12
33
13
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public void test() throws IOException {
18
18
Retrofit retrofit = new Retrofit .Builder ()
19
19
.baseUrl ("https://api.github.com/" )
20
20
.addConverterFactory (ScalarsConverterFactory .create ())
21
- // .addConverterFactory(GsonConverterFactory.create())
21
+ .addConverterFactory (GsonConverterFactory .create ())
22
22
.build ();
23
23
24
24
GitHubService service = retrofit .create (GitHubService .class );
Original file line number Diff line number Diff line change
1
+ package org .example ;
2
+
3
+ import com .fasterxml .jackson .databind .DeserializationFeature ;
4
+ import com .fasterxml .jackson .databind .ObjectMapper ;
5
+ import io .avaje .http .client .HttpClientContext ;
6
+ import io .avaje .http .client .JacksonBodyAdapter ;
7
+ import io .avaje .http .client .RequestLogger ;
8
+ import org .junit .jupiter .api .Test ;
9
+
10
+ import java .util .List ;
11
+
12
+ class SimpleTest {
13
+
14
+ @ Test
15
+ void listRepos () {
16
+
17
+ final ObjectMapper objectMapper = new ObjectMapper ()
18
+ .configure (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES , false );
19
+
20
+ final HttpClientContext clientContext =
21
+ HttpClientContext .newBuilder ()
22
+ .withBaseUrl ("https://api.github.com" )
23
+ .withRequestListener (new RequestLogger ())
24
+ .withBodyAdapter (new JacksonBodyAdapter (objectMapper ))
25
+ .build ();
26
+
27
+ Simple simple = new Simple$httpclient (clientContext );
28
+
29
+ final List <Repo > repos = simple .listRepos ("octocat" , "rbygrave" );
30
+ System .out .println ("done: " + repos );
31
+
32
+ final List <Repo > repos2 = simple .listRepos ("octocat" , "rbygrave" );
33
+ System .out .println ("done2: " + repos2 );
34
+
35
+ final List <Repo > repos3 = simple .listRepos ("octocat" , "rbygrave" );
36
+ System .out .println ("done3: " + repos3 );
37
+
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ <configuration scan =" true" scanPeriod =" 10 seconds" >
2
+ <appender name =" STDOUT" class =" ch.qos.logback.core.ConsoleAppender" >
3
+ <filter class =" ch.qos.logback.classic.filter.ThresholdFilter" >
4
+ <level >TRACE</level >
5
+ </filter >
6
+ <encoder class =" ch.qos.logback.classic.encoder.PatternLayoutEncoder" >
7
+ <pattern >%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern >
8
+ </encoder >
9
+ </appender >
10
+
11
+ <root level =" WARN" >
12
+ <appender-ref ref =" STDOUT" />
13
+ </root >
14
+
15
+ <logger name =" io.javalin" level =" INFO" />
16
+ <logger name =" org.example" level =" DEBUG" />
17
+ <logger name =" io.avaje.http.client" level =" DEBUG" />
18
+
19
+ </configuration >
You can’t perform that action at this time.
0 commit comments