Package org.jboss.resteasy.client

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


         Assert.assertEquals(response.getEntity(), "plain" + 1);
      }

      {
         ClientRequest request = new ClientRequest(generateURL("/cache/accepts"));
         request.accept("text/html");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(200, response.getStatus());
         String cc = response.getResponseHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
         Assert.assertNotNull(cc);
         etag = response.getResponseHeaders().getFirst(HttpHeaders.ETAG);
View Full Code Here


         Assert.assertNotNull(etag);
         Assert.assertEquals(response.getEntity(), "html" + 1);
      }
      {
         ClientRequest request = new ClientRequest(generateURL("/cache/accepts"));
         request.accept("text/html");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(200, response.getStatus());
         String cc = response.getResponseHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
         Assert.assertNotNull(cc);
         etag = response.getResponseHeaders().getFirst(HttpHeaders.ETAG);
View Full Code Here

      plainCount = 0;
      htmlCount = 0;
      String etag = null;
      {
         ClientRequest request = new ClientRequest(generateURL("/cache/accepts"));
         request.accept("text/plain");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(200, response.getStatus());
         String cc = response.getResponseHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
         Assert.assertNotNull(cc);
         etag = response.getResponseHeaders().getFirst(HttpHeaders.ETAG);
View Full Code Here

         Assert.assertEquals(response.getEntity(), "plain" + 1);
      }

      {
         ClientRequest request = new ClientRequest(generateURL("/cache/accepts"));
         request.accept("text/html");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(200, response.getStatus());
         String cc = response.getResponseHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
         Assert.assertNotNull(cc);
         etag = response.getResponseHeaders().getFirst(HttpHeaders.ETAG);
View Full Code Here

      plainCount = 0;
      htmlCount = 0;
      String etag = null;
      {
         ClientRequest request = new ClientRequest(generateURL("/cache/accepts"));
         request.accept("text/plain");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(200, response.getStatus());
         String cc = response.getResponseHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
         Assert.assertNotNull(cc);
         etag = response.getResponseHeaders().getFirst(HttpHeaders.ETAG);
View Full Code Here

      log.info("id: " + id2);
      Assert.assertEquals(Counter.INITIAL_VALUE + 1, id2);

      // Retrieve first book.
      request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/book/" + id1);
      request.accept("application/test+xml");
      response = request.get();
      invocationCounter++;
      log.info("Status: " + response.getStatus());
      assertEquals(200, response.getStatus());
      Book result = response.getEntity(Book.class);
View Full Code Here

      log.info("book: " + book1);
      Assert.assertEquals(book1, result);

      // Retrieve second book.
      request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/book/" + id2);
      request.accept("application/test+xml");
      response = request.get();
      invocationCounter++;
      log.info("Status: " + response.getStatus());
      assertEquals(200, response.getStatus());
      result = response.getEntity(Book.class);
View Full Code Here

      log.info("book: " + book2);
      Assert.assertEquals(book2, result);

      // Retrieve all books.
      request = new ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/books/");
      request.accept(MediaType.APPLICATION_XML);
      response = request.get();
      invocationCounter++;
      log.info("Status: " + response.getStatus());
      @SuppressWarnings("unchecked")
      Collection<Book> books  = response.getEntity(Collection.class, BookCollectionType);
View Full Code Here

    private static ClientResponse publish(@Nonnull String url,
            @Nonnull String data, @Nonnull MediaType acceptType,
            @Nonnull MediaType mediaType) {
        try {
            ClientRequest request = new ClientRequest(url);
            request.accept(acceptType);
            request.body(mediaType, data);
            return request.post();
        } catch (Exception e) {
            log.error("Error on webHooks post {}", e, url);
            return null;
View Full Code Here

        ClientRequest request = new ClientRequest("http://localhost/", new InProcessClientExecutor(httpAppTester));
        JsonNode testResource = objectMapper.readValue("{\"name\":\"test\"}", JsonNode.class);
        ClientResponse<JsonNode> response = request.body(MediaType.APPLICATION_JSON, testResource).post(JsonNode.class);

        request = new ClientRequest(response.getLocation().getHref(), new InProcessClientExecutor(httpAppTester));
        response = request.accept(MediaType.APPLICATION_JSON).get(JsonNode.class);

        Assert.assertEquals(200, response.getStatus());
        JsonNode entity = response.getEntity();
        Assert.assertEquals(testResource, entity);
    }
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.