added update method

This commit is contained in:
Sebastian Sdorra
2010-09-04 15:54:04 +02:00
parent 92ae4efc1d
commit d45f02859b
2 changed files with 54 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import javax.inject.Singleton;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@@ -76,6 +77,35 @@ public class GroupsResource
"groups/".concat(group.getName()))).build();
}
/**
* Method description
*
*
*
* @param name
* @param group
*
* @return
*/
@PUT
@Path("{name}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response update(@PathParam("name") String name, Group group)
{
Group updateGroup = groupStore.get(name);
if (updateGroup == null)
{
throw new WebApplicationException(Status.NOT_FOUND);
}
updateGroup.setName(name);
updateGroup.setMembers(group.getMembers());
return Response.created(
uriInfo.getAbsolutePath().resolve(group.getName())).build();
}
//~--- get methods ----------------------------------------------------------
/**