Package org.apache.abdera.protocol.client

Examples of org.apache.abdera.protocol.client.CommonsClient.post()


    // Verify the signature with Verisign's "Signed Ping" interop endpoint
    Client client = new CommonsClient();
    RequestOptions reqoptions = client.getDefaultRequestOptions();
    reqoptions.setContentType("application/xml");
    BaseRequestEntity bre = new BaseRequestEntity(entry,false);
    ClientResponse response = client.post(
      "http://verisignlabs.com/tg/verify",
      bre, reqoptions);
    assertEquals(response.getStatus(),200);
    Document<Element> result = response.getDocument();
   
View Full Code Here


        URLEncoder.encode(Version.APP_NAME, "utf-8"));
      StringRequestEntity stringreq = new StringRequestEntity(f.toString());
      String uri = "https://www.google.com/accounts/ClientLogin";
      RequestOptions options = client.getDefaultRequestOptions();
      options.setContentType("application/x-www-form-urlencoded");
      ClientResponse response = client.post(uri, stringreq, options);
      InputStream in = response.getInputStream();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      int n = -1;
      while ((n = in.read()) != -1) { out.write(n); }
      out.flush();
View Full Code Here

    } finally {
      response.release();
    }

    // post a new entry
    response = client.post(col_uri, entry, options);

    String self_uri;

    try {
      assertEquals(201, response.getStatus());
View Full Code Here

    // Post the media resource
    options = client.getDefaultRequestOptions();
    options.setContentType("text/plain");
    options.setHeader("Connection", "close");

    response = client.post(col_uri,
                           new ByteArrayInputStream("test".getBytes()),
                           options);

    try {
      assertEquals(201, response.getStatus());
View Full Code Here

   
    // calling a method that could change state on the server should invalidate the cache
    options.setHeader("x-reqnum", "2");
    switch(type) {
      case POST: 
        response = client.post(
          CHECK_CACHE_INVALIDATE,
          new ByteArrayInputStream("".getBytes()),
          options);
        break;
      case PUT:
View Full Code Here

    } finally {
      response.release();
    }

    // post a new entry
    response = client.post(col_uri, entry, options);

    String self_uri;

    try {
      assertEquals(201, response.getStatus());
View Full Code Here

    // Post the media resource
    options = client.getDefaultRequestOptions();
    options.setContentType("text/plain");
    options.setHeader("Connection", "close");

    response = client.post(col_uri,
                           new ByteArrayInputStream("test".getBytes()),
                           options);

    try {
      assertEquals(201, response.getStatus());
View Full Code Here

    entry.addAuthor("James");
    entry.setContent("This is the content");
    report("The Entry to Post", entry.toString());
   
    // Post the entry. Be sure to grab the resolved HREF of the collection
    Document<Entry> doc = client.post(
      collection.getResolvedHref().toString(),
      entry).getDocument();
   
    // In some implementations (such as Google's GData API, the entry URI is
    // distinct from it's edit URI.  To be safe, we should assume it may be
View Full Code Here

   
    RequestOptions options = client.getDefaultRequestOptions();
    options.setUseChunked(false);
   
    // Post the entry
    Response response = client.post(
      "http://beta.blogger.com/feeds/7352231422284704069/posts/full",
      entry, options);
   
    // Check the response.
    if (response.getStatus() == 201)
View Full Code Here

    Service service = service_doc.getRoot();
    Collection collection = service.getWorkspaces().get(0).getCollections().get(0);
    String uri = collection.getHref().toString();
     
    // Post the entry to the collection
    Response response = client.post(uri, entry);
   
    // Check the result
    if (response.getStatus() == 201)
      System.out.println("Success!");
    else
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.