예제 #1
0
 protected static DeleteMethod httpDelete(String path) throws IOException {
   LOG.info("Connecting to {}", url + path);
   HttpClient httpClient = new HttpClient();
   DeleteMethod deleteMethod = new DeleteMethod(url + path);
   deleteMethod.addRequestHeader("Origin", url);
   httpClient.executeMethod(deleteMethod);
   LOG.info("{} - {}", deleteMethod.getStatusCode(), deleteMethod.getStatusText());
   return deleteMethod;
 }
 @Override
 public boolean deleteFromStore(String locator, Mailbox mbox) throws IOException {
   HttpClient client = ZimbraHttpConnectionManager.getInternalHttpConnMgr().newHttpClient();
   DeleteMethod delete = new DeleteMethod(getDeleteUrl(mbox, locator));
   try {
     int statusCode = HttpClientUtil.executeMethod(client, delete);
     if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_NO_CONTENT) {
       return true;
     } else if (statusCode == HttpStatus.SC_NOT_FOUND) {
       return false;
     } else {
       throw new IOException(
           "unexpected return code during blob DELETE: " + delete.getStatusText());
     }
   } finally {
     delete.releaseConnection();
   }
 }