File tree 2 files changed +32
-1
lines changed
src/main/java/br/edu/inatel/task/api
2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,11 @@ dependencies {
27
27
28
28
// Java Servlet
29
29
providedCompile " javax.servlet:servlet-api:2.5"
30
-
30
+
31
+ // Jersey
32
+ compile ' org.glassfish.jersey.containers:jersey-container-servlet:2.14'
33
+ compile ' org.glassfish.jersey.media:jersey-media-json-jackson:2.14'
34
+
31
35
// Declare the dependency for your favourite test framework you want to use in your tests.
32
36
// TestNG is also supported by the Gradle Test task. Just change the
33
37
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
Original file line number Diff line number Diff line change
1
+ package br .edu .inatel .task .api ;
2
+
3
+ import br .edu .inatel .task .model .Task ;
4
+ import br .edu .inatel .task .model .TaskDAO ;
5
+
6
+ import javax .ws .rs .GET ;
7
+ import javax .ws .rs .Path ;
8
+ import javax .ws .rs .Produces ;
9
+ import javax .ws .rs .core .MediaType ;
10
+ import javax .ws .rs .core .Response ;
11
+ import java .util .ArrayList ;
12
+
13
+ @ Path ("/tasks" )
14
+ public class TaskService {
15
+
16
+ TaskDAO taskDAO = new TaskDAO ();
17
+
18
+ @ GET
19
+ @ Produces (MediaType .APPLICATION_JSON )
20
+ public Response list () {
21
+ ArrayList <Task > tasks = taskDAO .list ();
22
+ return Response
23
+ .ok ()
24
+ .entity (tasks )
25
+ .build ();
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments