Package org.apache.abdera.protocol.client

Examples of org.apache.abdera.protocol.client.ClientResponse.release()


      InputStream in = response.getInputStream();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      int n = -1;
      while ((n = in.read()) != -1) { out.write(n); }
      out.flush();
      response.release();
      String auth = new String(out.toByteArray());
      return auth.split("\n")[2].replaceAll("Auth=", "auth=");
    } catch (Exception e) {}
    return null;
  }
View Full Code Here


      InputStream in = response.getInputStream();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      int n = -1;
      while ((n = in.read()) != -1) { out.write(n); }
      out.flush();
      response.release();
      String auth = new String(out.toByteArray());
      return auth.split("\n")[2].replaceAll("Auth=", "auth=");
    } catch (Exception e) {}
    return null;
  }
View Full Code Here

      assertEquals(200, response.getStatus());

      Document<Entry> entry_doc = response.getDocument();
      assertEquals("New title", entry_doc.getRoot().getTitle());
    } finally {
      response.release();
    }

    // delete the entry
    response = client.delete(edit_uri, options);
View Full Code Here

    response = client.delete(edit_uri, options);

    try {
      assertEquals(204, response.getStatus());
    } finally {
      response.release();
    }

    // is it gone?
    response = client.get(self_uri, options);
View Full Code Here

    response = client.get(self_uri, options);

    try {
      assertEquals(404, response.getStatus());
    } finally {
      response.release();
    }

    // YAY! We're a working APP client
   
    // Now let's try to do a media post
View Full Code Here

      assertNotNull(response.getLocation());
      assertNotNull(response.getContentLocation());
   
      self_uri = response.getLocation().toString();
    } finally {
      response.release();
    }

    // was an entry created?
    options = client.getDefaultRequestOptions();
    options.setHeader("Connection", "close");
View Full Code Here

      // edit the entry
      Document doc = response.getDocument();
      entry = (Entry) doc.getRoot().clone();
      entry.setTitle("New title");
    } finally {
      response.release();
    }

    // submit the changes
    options = client.getDefaultRequestOptions();
    options.setContentType("application/atom+xml");
View Full Code Here

    response = client.put(edit_uri, entry, options);

    try {
      assertEquals(204, response.getStatus());
    } finally {
      response.release();
    }

    // get the media resource
    response = client.get(media);
View Full Code Here

      assertEquals(200, response.getStatus());

      String mediavalue = read(response.getInputStream());
      assertEquals("test", mediavalue);
    } finally {
      response.release();
    }

    // edit the media resource
    options = client.getDefaultRequestOptions();
    options.setHeader("Connection", "close");
View Full Code Here

                          options);

    try {
      assertEquals(204, response.getStatus());
    } finally {
      response.release();
    }

    // was the resource changed?
    response = client.get(media, options);
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.