コード例 #1
0
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 public Response getUsuarios(@PathParam("id") String id) throws MyException {
   List<Civica> civicas = new ArrayList<Civica>();
   civicas = civicaDAO.leerTodos();
   return Response.ok() // 200
       .entity(civicas)
       .header("Access-Control-Allow-Origin", "*")
       .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
       .build();
 }
コード例 #2
0
  @GET
  @Path("/{civica_id}")
  @Produces(MediaType.APPLICATION_JSON)
  @Transactional
  public Response getUser(@PathParam("civica_id") String civica_id) throws MyException {

    Civica civica = new Civica();
    civica = civicaDAO.leer(civica_id);
    return Response.ok() // 200
        .entity(civica)
        .header("Access-Control-Allow-Origin", "*")
        .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
        .build();
  }