45 |
return t.getLog(); |
return t.getLog(); |
46 |
} |
} |
47 |
|
|
48 |
|
@Path("/remove/{id}") |
49 |
|
@GET |
50 |
|
@Produces(MediaType.TEXT_PLAIN) |
51 |
|
public String removeTask(@Context ServletContext context, @PathParam("id") int taskId ) { |
52 |
|
TaskManager taskManager = (TaskManager) context.getAttribute(TaskManager.TASKMANAGER); |
53 |
|
Task removeTask = taskManager.getTaskById(taskId); |
54 |
|
|
55 |
|
if (removeTask == null ){ |
56 |
|
return "No task with id: " + taskId; |
57 |
|
} |
58 |
|
|
59 |
|
taskManager.removeTask(removeTask); |
60 |
|
|
61 |
|
return "OK"; |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
} |
} |