Package org.apache.abdera.protocol.client

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


    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 = abderaClient.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 = abderaClient.getDefaultRequestOptions();
    options.setUseChunked(false);
   
    // Post the entry
    Response response = abderaClient.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 = abderaClient.post(uri, entry);
   
    // Check the result
    if (response.getStatus() == 201)
      System.out.println("Success!");
    else
View Full Code Here

    // current Roller APP implementation still currently requires it.
    RequestOptions options = abderaClient.getDefaultRequestOptions();
    options.setHeader("Title", "mypodcast.mp3");
   
    // Post the entry
    Response response = abderaClient.post(uri, re, options);
   
    // Check the response
    if (response.getStatus() == 201)
      System.out.println("Success!");
    else
View Full Code Here

   
    RequestOptions options = abderaClient.getDefaultRequestOptions();
    options.setUseChunked(false);
   
    // Post the entry
    Response response = abderaClient.post(uri, entry, options);
   
    // Google Calendar might return a 302 response with a new POST URI.
    // If it does, get the new URI and post again
    if (response.getStatus() == 302) {
      uri = response.getLocation().toString();
View Full Code Here

   
    // Google Calendar might return a 302 response with a new POST URI.
    // If it does, get the new URI and post again
    if (response.getStatus() == 302) {
      uri = response.getLocation().toString();
      response = abderaClient.post(uri, entry, options);
    }
   
    // Check the response
    if (response.getStatus() == 201)
      System.out.println("Success!");
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 = abderaClient.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
        // different
        IRI entryUri = doc.getBaseUri();
View Full Code Here

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

        entry.setSummary("This is my entry.");
        entry.setContent("This is my entry. It's swell.");

        RequestOptions opts = new RequestOptions();
        opts.setContentType("application/atom+xml;type=entry");
        ClientResponse res = client.post(colUri.toString(), entry, opts);
        assertEquals(201, res.getStatus());

        // prettyPrint(abdera, res.getDocument());

        IRI location = res.getLocation();
View Full Code Here

        // calling a method that could change state on the server should invalidate the cache
        options = getRequestOptions(abderaClient, 2);
        switch (type) {
            case POST:
                response = abderaClient.post(CHECK_CACHE_INVALIDATE, new ByteArrayInputStream("".getBytes()), options);
                break;
            case PUT:
                response = abderaClient.put(CHECK_CACHE_INVALIDATE, new ByteArrayInputStream("".getBytes()), options);
                break;
            case DELETE:
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.