Package org.jboss.resteasy.client

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


         Assert.assertEquals("basic", response.getEntity());
      }

      {
         ClientRequest request = new ClientRequest(generateURL("/basic"));
         request.body("text/plain", "basic");
         ClientResponse<?> response = request.put();
         Assert.assertEquals(204, response.getStatus());
      }
     
      {
View Full Code Here


      // Update and send a bad etag with conditional PUT
      cust.setCity("Bedford");
      request.clear();
      request.header("If-Match", "JUNK");
      request.body("application/xml", cust);
      ClientResponse response2 = request.put();
      Assert.assertEquals(412, response2.getStatus());
   }
}
View Full Code Here

      request = new ClientRequest(shoppingLinks.get("products").getHref());

      Product product = new Product();
      product.setName("iPhone");
      product.setCost(199.99);
      request.body("application/xml", product);
      response = request.post();
      response.releaseConnection();
      Assert.assertEquals(201, response.getStatus());

      product = new Product();
View Full Code Here

      Assert.assertEquals(201, response.getStatus());

      product = new Product();
      product.setName("MacBook Pro");
      product.setCost(3299.99);
      request.body("application/xml", product);
      response = request.post();
      response.releaseConnection();
      Assert.assertEquals(201, response.getStatus());

      product = new Product();
View Full Code Here

      Assert.assertEquals(201, response.getStatus());

      product = new Product();
      product.setName("iPod");
      product.setCost(49.99);
      request.body("application/xml", product);
      response = request.post();
      response.releaseConnection();
      Assert.assertEquals(201, response.getStatus());

   }
View Full Code Here

         customer.setCity("Boston");
         customer.setState("MA");
         customer.setZip("02115");
         customer.setCountry("USA");
         request = new ClientRequest(shoppingLinks.get("customers").getHref());
         request.body("application/xml", customer);
         response = request.post();
         Assert.assertEquals(201, response.getStatus());
         String uri = (String) response.getResponseHeaders().getFirst("Location");

         request = new ClientRequest(uri);
View Full Code Here

      order.setTotal(product.getCost());
      order.setCustomer(customer);
      order.setDate(new Date().toString());
      order.getLineItems().add(item);
      request = new ClientRequest(shoppingLinks.get("orders").getHref());
      request.body("application/xml", order);
      response = request.post();
      Assert.assertEquals(201, response.getStatus());

      System.out.println();
      System.out.println("** Show all orders.");
View Full Code Here

    
   @Test
   public void testOneway() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9095/resource?oneway=true");
      request.body("text/plain", "content");
      ClientResponse<String> response = request.put(String.class);
      Assert.assertEquals(202, response.getStatus());
      response.releaseConnection();
      Thread.sleep(1500);
      request = new ClientRequest("http://localhost:9095/resource");
View Full Code Here

   @Test
   public void testAsynch() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9095/resource?asynch=true");
      request.body("text/plain", "content");
      ClientResponse<String> response = request.post(String.class);
      Assert.assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatus());
      String jobUrl1 = response.getResponseHeaders().getFirst(HttpHeaders.LOCATION);
      System.out.println("jobUrl1: " + jobUrl1);
      response.releaseConnection();
View Full Code Here

    public void sendMessage(String callbackURI, String messageSenderId, String message) {
       ClientRequest request = null;
       ClientResponse<?> response = null;
       try {
          request = new ClientRequest(getPushMessageURL(callbackURI, messageSenderId));
          request.body("text/plain", message);
          response = request.post();
          if (HttpResponseCodes.SC_OK != response.getStatus()) {
             throw new RuntimeException("Message can not be delivered to subscribers");
          }
       } catch (Exception ex)
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.