Skip to content

Commit a73f024

Browse files
committed
Added dependencies and TaskService
1 parent 68a1b48 commit a73f024

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

build.gradle

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ dependencies {
2727

2828
// Java Servlet
2929
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+
3135
// Declare the dependency for your favourite test framework you want to use in your tests.
3236
// TestNG is also supported by the Gradle Test task. Just change the
3337
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
}

0 commit comments

Comments
 (0)