Package org.apache.abdera.protocol.client

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


    }

    public void restoreVersion(String versionPath) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        Entry entry = abdera.getFactory().newEntry();
        ClientResponse resp = abderaClient.post(baseURI + APPConstants.ATOM +
                encodeURL(versionPath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_RESTORE),
                entry,
                getAuthorization());
View Full Code Here


        AbderaClient abderaClient = new AbderaClient(abdera);
        final Factory factory = abdera.getFactory();
        Element el = factory.newElement(APPConstants.QN_ASSOC);
        el.setAttributeValue(APPConstants.ASSOC_TYPE, associationType);
        el.setText(associationPaths);
        ClientResponse resp = abderaClient.post(baseURI + APPConstants.ATOM +
                encodeURL(sourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.ASSOCIATIONS),
                el,
                getAuthorization());
View Full Code Here

    public void applyTag(String resourcePath, String tag) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        Entry entry = abdera.getFactory().newEntry();
        entry.setContent(tag);
        ClientResponse resp = abderaClient.post(baseURI + APPConstants.ATOM +
                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_TAGS),
                entry,
                getAuthorization());
View Full Code Here

        entry.setTitle("Comment");
        entry.setUpdated(comment.getCreatedTime());
        entry.addAuthor(comment.getUser());
        entry.setContent(comment.getText());
        ClientResponse resp =
                abderaClient.post(baseURI + APPConstants.ATOM +
                        encodeURL(resourcePath +
                                RegistryConstants.URL_SEPARATOR +
                                APPConstants.PARAMETER_COMMENTS),
                        entry,
                        getAuthorization());
View Full Code Here

    }

    public void rateResource(String resourcePath, int rating) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        ByteArrayInputStream is = new ByteArrayInputStream(Integer.toString(rating).getBytes());
        ClientResponse resp = abderaClient.post(baseURI + APPConstants.ATOM +
                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_RATINGS),
                is,
                getAuthorization());
View Full Code Here

        customerEl.setAttributeValue(new QName("name"), "Dan Diephouse");
        entry.setContent(customerEl);

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

        IRI location = res.getLocation();
        assertEquals(basePath + "/customers/1001-Dan_Diephouse", location.toString());
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

    customerEl.setAttributeValue(new QName("name"), "Dan Diephouse");
    entry.setContent(customerEl);

    RequestOptions opts = new RequestOptions();
    opts.setContentType("application/atom+xml;type=entry");
    res = client.post(colUri.toString() + "?test=foo", 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:
View Full Code Here

    entry.addAuthor("david");
    entry.setId("tag:apache.org,2008:234534344");
    entry.setSummary("multipart test");   
    entry.setContent(new IRI("cid:234234@example.com"), contentType);

    ClientResponse res = client.post("http://localhost:9002/media", entry,
        this.getClass().getResourceAsStream("info.png"));
    assertEquals(status, res.getStatus());
  }
}
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.