Package server.model

Examples of server.model.Model


    // curl -i -X GET http://localhost:8080/model/<id>
    @GET
    @Path("{id: \\d+}")
    public Response read(@PathParam("id") Long id) {
  Model model = repository.findOne(id);
  if (model == null) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  return Response.status(Response.Status.OK).entity(model).build();
    }
View Full Code Here


    }

    // curl -i -X PUT -H "Content-Type: application/json" -d '{"id":"<id>", "key": "k", "value": "v"}' http://localhost:8080/model
    @PUT
    public Response update(Model model) {
  Model updated = repository.save(model);
  return Response.created(URI.create("" + updated.id)).build();
    }
View Full Code Here

    public Response create(Model model) {
  if (model.id != 0) {
      Response.status(Response.Status.BAD_REQUEST).entity("Invalid Id").build();
  }

  Model saved = repository.save(model);
  return Response.created(URI.create("" + saved.id)).build();
    }
View Full Code Here

TOP

Related Classes of server.model.Model

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.