Package org.jboss.resteasy.client

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


   @Test
   public void testFormParamWithNoQueryParamPostEncoded() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/post/noquery/encoded");
      request.formParameter("formParam", "abc xyz");
      request.header("Content-Type", "application/x-www-form-urlencoded");
      ClientResponse<String> response = request.post(String.class);
      assertTrue(response != null);
      System.out.println("response: " + response.getEntity());
      assertEquals("abc+xyz", response.getEntity());
   }
View Full Code Here


   @Test
   public void testFormParamWithQueryParamPut() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/put/query?query=xyz");
      request.formParameter("formParam", "abc xyz");
      request.header("Content-Type", "application/x-www-form-urlencoded");
      ClientResponse<String> response = request.put(String.class);
      assertTrue(response != null);
      System.out.println("response: " + response.getEntity());
      assertEquals("abc xyz", response.getEntity());
   }
View Full Code Here

   @Test
   public void testFormParamWithQueryParamPutEncoded() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/put/query/encoded?query=xyz");
      request.formParameter("formParam", "abc xyz");
      request.header("Content-Type", "application/x-www-form-urlencoded");
      ClientResponse<String> response = request.put(String.class);
      assertTrue(response != null);
      System.out.println("response: " + response.getEntity());
      assertEquals("abc+xyz", response.getEntity());
   }
View Full Code Here

   @Test
   public void testFormParamWithQueryParamPost() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/post/query?query=xyz");
      request.formParameter("formParam", "abc xyz");
      request.header("Content-Type", "application/x-www-form-urlencoded");
      ClientResponse<String> response = request.post(String.class);
      assertTrue(response != null);
      System.out.println("response: " + response.getEntity());
      assertEquals("abc xyz", response.getEntity());
   }
View Full Code Here

   @Test
   public void testFormParamWithQueryParamPostEncoded() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9090/RESTEASY-760/post/query/encoded?query=xyz");
      request.formParameter("formParam", "abc xyz");
      request.header("Content-Type", "application/x-www-form-urlencoded");
      ClientResponse<String> response = request.post(String.class);
      assertTrue(response != null);
      System.out.println("response: " + response.getEntity());
      assertEquals("abc+xyz", response.getEntity());
   }
View Full Code Here

   protected ClientRequest createRequest(Object[] args)
   {
      ClientRequest request = new ClientRequest(uri, executor, providerFactory);
      request.getAttributes().putAll(attributes);
      if (accepts != null) request.header(HttpHeaders.ACCEPT, accepts.toString());
      this.copyClientInterceptorsTo(request);

      boolean isClientResponseResult = ClientResponse.class.isAssignableFrom(method.getReturnType());
      request.followRedirects(!isClientResponseResult || this.followRedirects);
View Full Code Here

   @Test
   public void testPutStream() throws Exception
   {
      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/stream"));
      request.header("Content-Encoding", "gzip").body("text/plain", "hello world");
      ClientResponse res = request.put();
      Assert.assertEquals(204, res.getStatus());
   }

   @Test
View Full Code Here

   @Test
   public void testPutText() throws Exception
   {
      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/text"));
      request.header("Content-Encoding", "gzip").body("text/plain", "hello world");
      ClientResponse res = request.put();
      Assert.assertEquals(204, res.getStatus());
   }

   @Test
View Full Code Here

    */
   @Test
   public void testMatch() throws Exception
   {
      ClientRequest request = new ClientRequest(generateURL("/match"));
      request.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
      ClientResponse<String> rtn = request.get(String.class);
      Assert.assertEquals("text/html", rtn.getResponseHeaders().getFirst("Content-Type"));
      String res = rtn.getEntity();
      Assert.assertEquals("*/*", res);
   }
View Full Code Here

      ClientRequest request = new ClientRequest("/foo", executor);
      request.body("text/plain", "hello world");
      Assert.assertEquals("hello world", request.postTarget(String.class));

      request = new ClientRequest("/foo", executor);
      request.header("a", "hello");
      request.queryParameter("b", "world");
      Assert.assertEquals("hello world", request.getTarget(String.class));

   }
}
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.