Package org.jboss.resteasy.client

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


    ClientRequest client = new ClientRequest(UriBuilder.fromUri(request.endpoint() + "/" + request.path()),
        ClientRequest.getDefaultExecutor(), providerFactory);

    for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) {
      for (Object o : entry.getValue()) {
        client = client.queryParameter(entry.getKey(), String.valueOf(o));
      }
    }

    for (Entry<String, List<Object>> h : request.headers().entrySet()) {
      StringBuilder sb = new StringBuilder();
View Full Code Here


    public static void userJoinsLanguageTeam(String username,
            String localesCSV) throws Exception {
        ClientRequest request =
                createRequest("/accounts/u/" + username + "/languages");

        checkAndReleaseConnection(request.queryParameter("locales", localesCSV)
                .put());
    }

    public static void makeSampleProject() throws Exception {
        checkAndReleaseConnection(createRequest("/project").put());
View Full Code Here

         Assert.assertEquals(204, response.getStatus());
      }
     
      {
         ClientRequest request = new ClientRequest(generateURL("/queryParam"));
         request.queryParameter("param", "hello world");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(200, response.getStatus());
         Assert.assertEquals("hello world", response.getEntity());
      }
View Full Code Here

   @Test
   public void testXmlEnumParam() throws Exception
   {
      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/enum"));
      request.queryParameter("loc", "north");
      String res = request.getTarget(String.class);
      Assert.assertEquals("NORTH", res.toUpperCase());

   }
View Full Code Here

  
   @Test
   public void testQuery() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:8081/query/list?q1=a&q2=b&q1=c");
      request.queryParameter("q1", "d");
      System.out.println("Sending request");
      ClientResponse<String> response = request.get(String.class);
      System.out.println("Received response: " + response.getEntity());
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("a:c:d:", response.getEntity());
View Full Code Here

   {
      ClientRequest request = new ClientRequest(generateURL("/generic/sub"));
      ClientResponse<String> response = null;
      try
      {
         response = request.queryParameter("foo", "42.0").get(String.class);
         Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
         Assert.assertEquals("42.0", response.getEntity());
      }

      catch (Exception e)
View Full Code Here

         Assert.assertEquals(204, response.getStatus());
      }
     
      {
         ClientRequest request = new ClientRequest(generateURL("/queryParam"));
         request.queryParameter("param", "hello world");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals("hello world", response.getEntity());
      }
View Full Code Here

      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

         Assert.assertEquals(204, response.getStatus());
      }

      {
         ClientRequest request = new ClientRequest(generateURL("/locating/queryParam"));
         request.queryParameter("param", "hello world");
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals("hello world", response.getEntity());
      }
View Full Code Here

  
   @Test
   public void testInvalidParam() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:8080/RESTEASY-923/test/resource");
      request.queryParameter("param", "abc");
      ClientResponse<?> response = request.get();
      String answer = response.getEntity(String.class);
      System.out.println("status: " + response.getStatus());
      System.out.println("entity: " + answer);
      assertEquals(400, 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.