Package org.jboss.resteasy.client

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


   @Test
   public void testBasicVerificationNoSignature() throws Exception
   {
      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/signed"), executor);
      request.body("text/plain", "hello world");
      ClientResponse response = request.post();
      Assert.assertEquals(401, response.getStatus());
      response.releaseConnection();
   }
View Full Code Here


      customer.setState("MA");
      customer.setZip("01711");
      customer.setCountry("USA");

      request = new ClientRequest(customers.getHref());
      request.body("application/xml", customer);
      response = request.post();
      Assert.assertEquals(201, response.getStatus());

      Link orders = shoppingLinks.get("orders");
View Full Code Here

      order.getLineItems().add(item);

      System.out.println();
      System.out.println("** Create an order through this URL: " + orders.getHref());
      request = new ClientRequest(orders.getHref());
      request.body("application/xml", order);
      response = request.post();
      Assert.assertEquals(201, response.getStatus());
      String createdOrderUrl = (String) response.getHeaders().getFirst("Location");

      System.out.println();
View Full Code Here

    obj.setName("Kyle\"");

    //Simple ClientRequest invocation
    ClientRequest request = new ClientRequest("http://localhost:8080/sampleRest");
    request.accept("application/json");
    request.body("application/json", obj);
    ClientResponse<String> response = request.post(String.class);
    String t = response.getEntity();
    System.out.println("testRestClientRequestSendString: " + t);

    //Proxy example
View Full Code Here

        
         {
            try
            {
               ClientRequest request = new ClientRequest(generateURL("/kunde"));
               request.body("application/xml", kundeXml);
               ClientResponse<?> response = request.post();
               Assert.assertEquals(204, response.getStatus());
               response.releaseConnection();
            }
            catch (IOException e)
View Full Code Here

         Assert.assertEquals(200, response.getStatus());
         Assert.assertEquals(100000, countFoos(entity));
      }
      {
         ClientRequest request = new ClientRequest(generateURL("/entityExpansion/collection"));
         request.body("application/xml", bigCollection);
         ClientResponse<?> response = request.post();
         System.out.println("status: " + response.getStatus());
         String entity = response.getEntity(String.class);
         System.out.println("doMaxEntitiesPasses() result: " + entity.substring(0, 30) + "...");
         Assert.assertEquals(200, response.getStatus());
View Full Code Here

         Assert.assertEquals(200, response.getStatus());
         Assert.assertEquals(200000, countFoos(entity));
      }
      {
         ClientRequest request = new ClientRequest(generateURL("/entityExpansion/map"));
         request.body("application/xml", bigMap);
         ClientResponse<?> response = request.post();
         System.out.println("status: " + response.getStatus());
         String entity = response.getEntity(String.class);
         System.out.println("doEntityExpansionPasses() result: " + entity.substring(0, 30) + "...");
         Assert.assertEquals(200, response.getStatus());
View Full Code Here

      response.releaseConnection();
     
      // Submit asynchronous job with violations in result of resource method.
      request = new ClientRequest(generateURL("/abc/xyz/unused/unused?asynch=true"));
      foo = new Foo("pqr");
      request.body("application/foo", foo);
      response = request.post(Foo.class);
      Assert.assertEquals(HttpServletResponse.SC_ACCEPTED, response.getStatus());
      jobUrl = response.getResponseHeaders().getFirst(HttpHeaders.LOCATION);
      System.out.println("JOB: " + jobUrl);
      response.releaseConnection();
View Full Code Here

   }
  
   void doMaxAttributesFails() throws Exception
   {
      ClientRequest request = new ClientRequest(generateURL("/maxAttributes"));
      request.body("application/xml", bigAttributeDoc);
      ClientResponse<?> response = request.post();
      System.out.println("status: " + response.getStatus());
      String entity = response.getEntity(String.class);
      System.out.println("doMaxAttributesFails() result: " + entity);
      Assert.assertEquals(400, response.getStatus());
View Full Code Here

   }
  
   void doMaxAttributesPasses() throws Exception
   {
      ClientRequest request = new ClientRequest(generateURL("/maxAttributes"));
      request.body("application/xml", bigAttributeDoc);
      ClientResponse<?> response = request.post();
      System.out.println("status: " + response.getStatus());
      String entity = response.getEntity(String.class);
      System.out.println("doMaxAttributesPasses() result: " + entity);
      Assert.assertEquals(200, response.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.