Package javax.ws.rs.client

Examples of javax.ws.rs.client.WebTarget.queryParam()


    Annotation[][] parameterAnnotations = method.getParameterAnnotations();
    for( int i = 0; i < parameterAnnotations.length; i++ ) {
      Annotation[] annotations = parameterAnnotations[ i ];
      String paramName = extractQueryParam( annotations );
      if( paramName != null ) {
        result = result.queryParam( paramName, parameter[ i ] );
      }
    }
    return result;
  }
View Full Code Here


    Annotation[][] parameterAnnotations = method.getParameterAnnotations();
    for( int i = 0; i < parameterAnnotations.length; i++ ) {
      Annotation[] annotations = parameterAnnotations[ i ];
      String paramName = extractQueryParam( annotations );
      if( paramName != null ) {
        result = result.queryParam( paramName, parameter[ i ] );
      }
    }
    return result;
  }
View Full Code Here

            {
               try
               {
                  log.debug("logging out: " + resource);
                  WebTarget target = client.target(resource).path(ServletActionURLs.J_OAUTH_REMOTE_LOGOUT);
                  if (username != null) target = target.queryParam("user", username);
                  javax.ws.rs.core.Response response = target.request()
                          .header("Authorization", "Bearer " + tokenString)
                          .put(null);
                  if (response.getStatus() != 204) log.error("Failed to log out");
                  response.close();
View Full Code Here

   @Test
   public void testQuery() throws Exception
   {
      WebTarget target = client.target(generateURL("/query"));
      String val = target.queryParam("param", "val").request().get(String.class);
      Assert.assertEquals("val", val);
   }

   @Test
   public void testEmpty() throws Exception
View Full Code Here

      Client client = ClientBuilder.newClient();
      String path = generateURL("/test");
      WebTarget target = client.target(path);

      String value = target.queryParam("a", "hello").request().get(String.class);
      Assert.assertEquals(value, "hello");

      Response response = target.request().put(Entity.text("hello"));
      Assert.assertEquals(204, response.getStatus());
View Full Code Here

      Client client = ClientBuilder.newClient();
      String path = generateURL("/test");
      WebTarget target = client.target(path);

      String value = target.queryParam("a", "hello").request().get(String.class);
      Assert.assertEquals(value, "hello");
      Assert.assertEquals(1, resource.counter);
      getRegistry().removeRegistrations(resourceclass);

   }
View Full Code Here

   public void testResponse() throws Exception
   {
      // fill out a query param and execute a get request
      Client client = ClientBuilder.newClient();
      WebTarget target = client.target("http://localhost:9095/customers");
      Response response = target.queryParam("name", "Bill").request().get();
      try
      {
         Assert.assertEquals(200, response.getStatus());
         Customer cust = response.readEntity(Customer.class);
         Assert.assertEquals("Bill", cust.getName());
View Full Code Here

      Client client = ClientBuilder.newClient();
      WebTarget target = client.target("http://localhost:9095/customers");
      try
      {
         // extract customer directly expecting success
         Customer cust = target.queryParam("name", "Bill").request().get(Customer.class);
         Assert.assertEquals("Bill", cust.getName());
      }
      finally
      {
         client.close();
View Full Code Here

      Client client = ClientBuilder.newClient();
      WebTarget target = client.target("http://localhost:9095/customers");
      try
      {
         // execute in background
         Future<Customer> future = target.queryParam("name", "Bill").request().async().get(Customer.class);
         // wait 10 seconds for a response
         Customer cust = future.get(10, TimeUnit.SECONDS);
         Assert.assertEquals("Bill", cust.getName());
      }
      finally
View Full Code Here

      WebTarget target = client.target("http://localhost:9095/customers");
      try
      {
         // execute in background
         final CountDownLatch latch = new CountDownLatch(1);
         target.queryParam("name", "Bill").request().async().get(new InvocationCallback<Customer>()
         {
            @Override
            public void completed(Customer customer)
            {
               System.out.println("Obtained customer: " + customer.getName());
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.