Package org.apache.cxf.jaxrs.client

Examples of org.apache.cxf.jaxrs.client.WebClient.reset()


        wc.back(false).path("children");
        getPersons(wc);

        System.out.println("Fred and Catherine now have a child, adding a child info to PersonService");
        Person child = new Person("Harry", 1);
        Response response = wc.reset().path("4").path("children").post(child);

        // 201 status and the Location header pointing to
        // a newly created (child) Person resource is expected
        if (response.getStatus() != 201) {
            throw new RuntimeException("No child resource has been created");
View Full Code Here


        p = getMember(1);

        System.out.println("Updating multiple fields of the person using PUT and .../members/1 URL:");
        p.setName("Bob");
        p.setAge(p.getAge() == 40 ? 30 : 40);
        resp = wc.reset().path("1").put(p);
        p = getMember(1);

        System.out.println("Creating a new member using POST and .../members/1 URL:");
        Person newMember = new Person();
        newMember.setName("Harry");
View Full Code Here

        System.out.println("Creating a new member using POST and .../members/1 URL:");
        Person newMember = new Person();
        newMember.setName("Harry");
        newMember.setAge(30);
        resp = wc.reset().post(newMember);

        if (resp.getStatus() != Response.Status.CREATED.getStatusCode()) {
            throw new RuntimeException("Could not add new member.");
        }
View Full Code Here

        wc.back(false);
        // Back to personServiceURI + "/4"
        getPerson(wc);

        // finally, do a basic search:
        wc.reset().path("find").accept(MediaType.APPLICATION_XML);
       
        wc.query("name", "Fred", "Lorraine");
        printPersonCollection(wc.get(PersonCollection.class));

       
View Full Code Here

            // resp.getStatus() returns 410 returned on successful DELETE, 404 if item not found          
            resp = wc.path(new Integer(maxID).toString()).delete();
        }

        // reprint of list with latest member removed
        wc.reset();
        getAllMembers(wc);
    }

    private Person getMember(int memberNo) throws Exception {
        WebClient wc = WebClient.create(urlStem);
View Full Code Here

            .query();
       
        findPersons(wc, query);
       
        //Moves to "/services/personservice/personinfo"
        wc.reset().accept(MediaType.APPLICATION_XML);
        wc.path("personinfo");
       
        System.out.println("Find all people younger than 40 using JPA2 Tuples");
        query = builder.is("age").lessThan(40).query();
       
View Full Code Here

          "barry@social.com", "1234");
      OAuthAuthorizationData data = authorizeClient.get(OAuthAuthorizationData.class);     
      Object authenticityCookie = authorizeClient.getResponse().getMetadata().getFirst("Set-Cookie");
           
      Form authorizationResult = getAuthorizationResult(data);
      authorizeClient.reset();
      authorizeClient.to(data.getReplyTo(), false);
      if (authenticityCookie != null) {
        authorizeClient.header("Cookie", (String)authenticityCookie);
      }
      Response r2 = authorizeClient.form(authorizationResult);
View Full Code Here

      OAuthAuthorizationData data = authorizeClient.get(OAuthAuthorizationData.class);     
      Object authenticityCookie = authorizeClient.getResponse().getMetadata().getFirst("Set-Cookie");
      System.out.println(authenticityCookie);
           
      Form authorizationResult = getAuthorizationResult(data);
      authorizeClient.reset();
      authorizeClient.to(data.getReplyTo(), false);
      if (authenticityCookie != null) {
        authorizeClient.header("Cookie", (String)authenticityCookie);
      }
      Response r2 = authorizeClient.form(authorizationResult);
View Full Code Here

        String result = wc.path("/webresources/helloworld").get(String.class);

        System.out.println("HELLO RESULT = " + result);
        assertEquals("Hello World", result);

        String result2 = wc.reset().path("/webresources/another").get(String.class);

        System.out.println("ANOTHER RESULT = " + result2);
        assertEquals("Another", result2);
    }
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.