@Path("/task")
public Response createTask(JaxbTaskWrapper incommingTask, @PathParam("category") String categoryName,
@Context UriInfo uriInfo) {
Category category = loadCategory(categoryName);
Task task = new Task();
task.setCategory(category);
task.setCreated(new Date());
task.setUpdated(task.getCreated()); // set update date to creation date
task.setName(incommingTask.getName());
task.setResolved(false); // not resolved by default
em.persist(task);
long id = task.getId();
URI uri = uriInfo.getBaseUriBuilder().path(TaskCollectionResource.class)
.path(TaskCollectionResource.class, "getTaskSubresource").build(String.valueOf(id));
return Response.created(uri).build();
}