Package org.jboss.as.quickstarts.tasksrs.model

Examples of org.jboss.as.quickstarts.tasksrs.model.Task


    @Path("tasks/{title}")
    public Response createTask(@Context UriInfo info, @Context SecurityContext context,
                               @PathParam("title"@DefaultValue("task") String taskTitle) {

        User user = getUser(context);
        Task task = new Task(taskTitle);

        taskDao.createTask(user, task);

        // Construct the URI for the newly created resource and put in into the Location header of the response
        // (assumes that there is only one occurrence of the task title in the request)
        String rawPath = info.getAbsolutePath().getRawPath().replace(task.getTitle(), task.getId().toString());
        UriBuilder uriBuilder = info.getAbsolutePathBuilder().replacePath(rawPath);
        URI uri = uriBuilder.build();

        return Response.created(uri).build();
    }
View Full Code Here


    }

    @DELETE
    @Path("tasks/{id}")
    public void deleteTaskById(@Context SecurityContext context, @PathParam("id") Long id) {
        Task task = getTaskById(context, id);

        taskDao.deleteTask(task);
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.quickstarts.tasksrs.model.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.