Package org.jboss.resteasy.client

Examples of org.jboss.resteasy.client.ClientRequest.post()


      System.out.println(response2.getEntity());
      Assert.assertEquals(200, response2.getStatus());

      request = new ClientRequest(generateURL("/products/333"));
      request.body("application/foo+json", p);
      response = request.post(Product.class);
      p = response.getEntity();
      Assert.assertEquals(333, p.getId());
      Assert.assertEquals("Iphone", p.getName());

View Full Code Here


      String xml = "<collection xmlns:foo=\"http://foo.com\">"
              + "<foo:foo test=\"hello\"/></collection>";

      ClientRequest request = new ClientRequest(generateURL("/namespaced/array"));
      request.body("application/xml", xml);
      ClientResponse<List<NamespacedFoo>> response = request.post(new GenericType<List<NamespacedFoo>>()
      {
      });
      List<NamespacedFoo> list = response.getEntity();
      Assert.assertEquals(1, list.size());
      Assert.assertEquals(list.get(0).getTest(), "hello");
View Full Code Here

      String xml = "<list xmlns:foo=\"http://foo.com\">"
              + "<foo:foo test=\"hello\"/></list>";

      ClientRequest request = new ClientRequest(generateURL("/namespaced/list"));
      request.body("application/xml", xml);
      ClientResponse<NamespacedFoo[]> response = request.post(new GenericType<NamespacedFoo[]>()
      {
      });
      NamespacedFoo[] list = response.getEntity();
      Assert.assertEquals(1, list.length);
      Assert.assertEquals(list[0].getTest(), "hello");
View Full Code Here

      String xml = "<bad-list>"
              + "<foo test=\"hello\"/></bad-list>";

      ClientRequest request = new ClientRequest(generateURL("/list"));
      request.body("application/xml", xml);
      ClientResponse<Foo[]> response = request.post(new GenericType<Foo[]>()
      {
      });
      Assert.assertEquals(400, response.getStatus());

   }
View Full Code Here

      ClientRequest request = new ClientRequest(TEST_URI + "/file/test");
      request
              .body(
                      "multipart/form-data; boundary=---------------------------52524491016334132001492192799",
                      form);
      ClientResponse<?> response = request.post();
      Assert.assertEquals(200, response.getStatus());

   }

   private static final String form = "-----------------------------52524491016334132001492192799\r\n"
View Full Code Here

      System.out.println(response2.getEntity());
      Assert.assertEquals(200, response2.getStatus());

      request = new ClientRequest(generateURL("/products/333"));
      request.body("application/foo+json", p);
      response = request.post(Product.class);
      p = response.getEntity();
      Assert.assertEquals(333, p.getId());
      Assert.assertEquals("Iphone", p.getName());

View Full Code Here

      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/test/string"));
      Customer cust = new Customer();
      String name = "bill\u00E9";
      cust.setName(name);
      request.body("application/xml", cust);
      request.post();


   }
   @Test
   public void testCase() throws Exception
View Full Code Here

      System.out.println("client name: " + name);

      System.out.println("bytes string: " + new String(name.getBytes("UTF-8"), "UTF-8"));
      cust.setName(name);
      request.body("application/xml", cust);
      request.post();


   }
}
View Full Code Here

        req.accept(MediaType.TEXT_PLAIN_TYPE);



        try {
            ClientResponse resp = req.post(String.class);
            if (resp.getStatus()==200) {
                log.debug(resp.getEntity());
            }
            else {
                log.warn("Error while sending SMS " + resp.getStatus());
View Full Code Here

        clientRequest.body(MediaType.APPLICATION_JSON_TYPE, json);

        // issue post against the Unified Push server:
        ClientResponse<String> resp = null;
        try {
            resp = clientRequest.post(String.class);
            int statusCode = resp.getStatus();
            if (statusCode != 200) {
                logger.severe("Receiving status code: " + statusCode);
            }
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.