Examples of DeleteMethod


Examples of com.sola.instagram.io.DeleteMethod

  public boolean removeComment(String mediaId, String commentId) throws Exception {
    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("media_id", mediaId);
    map.put("comment_id", commentId);
    String uri = uriConstructor.constructUri(UriFactory.Comments.DELETE_MEDIA_COMMENT, map, true);
    JSONObject object = (new DeleteMethod(uri)).call().getJSON();
    return object.getJSONObject("meta").getInt("code") == 200;
  }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

        byte[] output = constructArgs(method, args);
        ((PutMethod) method)
            .setRequestEntity(new ByteArrayRequestEntity(output));
      }
    } else if (methodType.equalsIgnoreCase("delete")) {
      method = new DeleteMethod(url);
    }

    if (parameters.get(ModelMap.RPC_ARGS_KEY) != null)
      method.addRequestHeader("content-type", "application/javabean");
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

    setDoAuthentication(method);
    return new HTTPRequest(this, method);
  }

  public HTTPRequest delete() {
    DeleteMethod method = new DeleteMethod(url);
    setDoAuthentication(method);
    return new HTTPRequest(this, method);
  }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

            break;
         case PUT:
            request = new PutMethod(url.toString());
            break;
         case DELETE:
            request = new DeleteMethod(url.toString());
            break;
         case TRACE:
            request = new TraceMethod(url.toString());
            break;
      }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

            break;
         case PUT:
            request = new PutMethod(url.toString());
            break;
         case DELETE:
            request = new DeleteMethod(url.toString());
            break;
         case TRACE:
            request = new TraceMethod(url.toString());
            break;
      }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

            break;
         case PUT:
            request = new PutMethod(url.toString());
            break;
         case DELETE:
            request = new DeleteMethod(url.toString());
            break;
         case TRACE:
            request = new TraceMethod(url.toString());
            break;
      }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

      {
         return new PostMethod(url);
      }
      else if ("DELETE".equals(restVerb))
      {
         return new DeleteMethod(url);
      }
      else
      {
         final String verb = restVerb;
         return new PostMethod(url)
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

    * @param path the request path
    * @return a DeleteMethod object
    */
   public static DeleteMethod createDeleteMethod(String path)
   {
      return new DeleteMethod(generateURL(path));
   }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

         status = client.executeMethod(get);
         Assert.assertEquals(HttpServletResponse.SC_OK, status);
         Assert.assertEquals(get.getResponseBodyAsString(), "content");

         // delete and test delete
         DeleteMethod delete = new DeleteMethod(jobUrl);
         status = client.executeMethod(delete);
         Assert.assertEquals(HttpServletResponse.SC_NO_CONTENT, status);

         status = client.executeMethod(get);
         Assert.assertEquals(HttpServletResponse.SC_GONE, status);

         method.releaseConnection();
      }

      {
         dispatcher.setMaxCacheSize(1);
         latch = new CountDownLatch(1);
         PostMethod method = new PostMethod("http://localhost:9091?asynch=true");
         method.setRequestEntity(new StringRequestEntity("content",
               "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpServletResponse.SC_ACCEPTED, status);
         String jobUrl1 = method.getResponseHeader(HttpHeaders.LOCATION)
               .getValue();
         Assert.assertTrue(latch.await(3, TimeUnit.SECONDS));

         latch = new CountDownLatch(1);
         method.setRequestEntity(new StringRequestEntity("content",
               "text/plain", null));
         status = client.executeMethod(method);
         Assert.assertEquals(HttpServletResponse.SC_ACCEPTED, status);
         String jobUrl2 = method.getResponseHeader(HttpHeaders.LOCATION)
               .getValue();
         Assert.assertTrue(latch.await(3, TimeUnit.SECONDS));

         Assert.assertTrue(!jobUrl1.equals(jobUrl2));

         GetMethod get = new GetMethod(jobUrl1);
         status = client.executeMethod(get);
         Assert.assertEquals(HttpServletResponse.SC_GONE, status);

         // test its still there
         get = new GetMethod(jobUrl2);
         status = client.executeMethod(get);
         Assert.assertEquals(HttpServletResponse.SC_OK, status);
         Assert.assertEquals(get.getResponseBodyAsString(), "content");

         // delete and test delete
         DeleteMethod delete = new DeleteMethod(jobUrl2);
         status = client.executeMethod(delete);
         Assert.assertEquals(HttpServletResponse.SC_NO_CONTENT, status);

         status = client.executeMethod(get);
         Assert.assertEquals(HttpServletResponse.SC_GONE, status);
View Full Code Here

Examples of org.apache.commons.httpclient.methods.DeleteMethod

         Assert.assertEquals(method.getResponseHeader("content-type").getValue(), "application/xml");
         byte[] responseBody = method.getResponseBody();
         String response = new String(responseBody, "US-ASCII");
         Assert.assertEquals("<customer><name>bill</name></customer>", response);

         DeleteMethod del = createDeleteMethod("/implicit");
         status = client.executeMethod(del);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);

         SimpleClient proxy = ProxyFactory.create(SimpleClient.class, generateBaseUrl());
         proxy.deleteCustomer();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.