Ejemplo n.º 1
0
 @DELETE
 @Path("{route_id}")
 @Produces(MediaType.APPLICATION_JSON)
 public String deletePlace(@PathParam("route_id") String routeID) {
   syncCache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO));
   JSONObject reply = new JSONObject();
   try {
     syncCache.delete(routeID);
     return reply
         .append("status", "OK")
         .append("message", "successfully deleted route " + routeID + " from " + "memcache")
         .toString();
   } catch (Exception e) {
     return new JSONObject().append("status", "fail").append("message", e.getMessage()).toString();
   }
 }
Ejemplo n.º 2
0
  @DELETE
  public void deleteIt() {

    // delete an entity from the datastore
    // just print a message upon exception (don't throw)
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService();
    if (syncCache.get(keyname) != null) {
      syncCache.delete(keyname);
    }
    Key entKey = KeyFactory.createKey("TaskData", keyname);
    try {
      Entity ent = datastore.get(entKey);
      datastore.delete(entKey);
      System.err.println("TaskData deleted in Datastore");
    } catch (EntityNotFoundException e) {
      System.err.println("TaskData not found in Datastore");
    }
  }