Package org.apache.abdera.protocol.client

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


        //invoke Guvnor REST API to store the process
        options = client.getDefaultRequestOptions();
        options.setContentType( "application/atom+xml" );

        resp = client.post( new URL( baseURL,
                                     "rest/packages/categoriesPackage1/assets" ).toExternalForm(),
                            processEntry,
                            options );

        if ( resp.getType() != ResponseType.SUCCESS ) {
View Full Code Here


                new org.apache.commons.httpclient.UsernamePasswordCredentials("admin", "admin"));
       
        options = client.getDefaultRequestOptions();
        options.setContentType(MediaType.APPLICATION_ATOM_XML);

        resp = client.post(new URL(baseURL, "rest/packages/restPackage1/assets").toExternalForm(), entry, options);
       
        if (resp.getType() != ResponseType.SUCCESS){
            fail("Couldn't store 'model1-New' asset-> "+resp.getStatus()+": "+resp.getStatusText());
        }      
       
View Full Code Here

      entry.setSummary("desc for testCreatePackageFromAtom");
        ExtensibleElement extension = entry.addExtension(Translator.METADATA);
        ExtensibleElement childExtension = extension.addExtension(Translator.CHECKIN_COMMENT);
        childExtension.addSimpleExtension(Translator.VALUE, "checkin comment:initial desc for testCreatePackageFromAtom");
       
      ClientResponse resp = client.post(new URL(baseURL, "rest/packages").toExternalForm(), entry);
        //System.out.println(GetContent(resp.getInputStream()));

    assertEquals(ResponseType.SUCCESS, resp.getType());

    Document<Entry> doc = resp.getDocument();
View Full Code Here

                new org.apache.commons.httpclient.UsernamePasswordCredentials("admin", "admin"));
        Entry entry = abdera.newEntry();       
        entry.setTitle("testRenamePackageFromAtom");
        entry.setSummary("desc for testRenamePackageFromAtom");
       
        ClientResponse resp = client.post(new URL(baseURL, "rest/packages").toExternalForm(), entry);
        //System.out.println(GetContent(resp.getInputStream()));
        assertEquals(ResponseType.SUCCESS, resp.getType());

        Document<Entry> doc = resp.getDocument();
        Entry returnedEntry = doc.getRoot();
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:
View Full Code Here

    } finally {
      response.release();
    }

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

    String self_uri;

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

    options = abderaClient.getDefaultRequestOptions();
    options.setContentType("text/plain");
    options.setHeader("Connection", "close");
    options.setUseExpectContinue(false);

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

    try {
      assertEquals(201, response.getStatus());
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

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.