Package javax.ws.rs.client

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


    @Test(expected = NullPointerException.class)
    public void testResolveTemplateNull2() {
        WebTarget wt = target;

        wt.resolveTemplate("name", null, true);
    }

    @Test(expected = NullPointerException.class)
    public void testResolveTemplateFromEncodedNull1() {
        WebTarget wt = target;
View Full Code Here


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

        for (int i = 0; i < config.requests; i++) {
            final int reqId = i;

            final JLabel requestStatusLabel = createRequestStatusLabel();

            echoResource.resolveTemplate("echo", reqId).request().async().get(new InvocationCallback<String>() {
                private final AtomicInteger retries = new AtomicInteger(0);

                @Override
                public void completed(final String response) {
                    invokeAndWait(new Runnable() {
View Full Code Here

                @Override
                public void failed(final Throwable error) {
                    if (error.getCause() instanceof IOException && retries.getAndIncrement() < 3) {
                        // resend
                        echoResource.resolveTemplate("echo", reqId).request().async().get(this);
                    } else {
                        invokeAndWait(new Runnable() {
                            @Override
                            public void run() {
                                requestStatusLabel.setBackground(ERROR_COLOR);
View Full Code Here

        final AtomicInteger requestCounter = new AtomicInteger(0);

        final long tic = System.currentTimeMillis();
        for (int i = 0; i < config.requests; i++) {
            final int reqId = i;
            echoResource.resolveTemplate("echo", reqId).request().async().get(new InvocationCallback<String>() {
                private final AtomicInteger retries = new AtomicInteger(0);

                @Override
                public void completed(String response) {
                    final String requestId = Integer.toString(reqId);
View Full Code Here

                @Override
                public void failed(Throwable error) {
                    if (error.getCause() instanceof IOException && retries.getAndIncrement() < 3) {
                        // resend
                        echoResource.resolveTemplate("echo", reqId).request().async().get(this);
                    } else {
                        System.out.print("!");
                        errors.offer(String.format("Request '%d' has failed: %s", reqId, error.toString()));
                        latch.countDown();
                    }
View Full Code Here

                    value = ((DefaultValue) ann).value();
                }

                if (value != null) {
                    if ((ann = anns.get(PathParam.class)) != null) {
                        newTarget = newTarget.resolveTemplate(((PathParam) ann).value(), value);
                    } else if ((ann = anns.get((QueryParam.class))) != null) {
                        newTarget = newTarget.queryParam(((QueryParam) ann).value(), value);
                    } else if ((ann = anns.get((HeaderParam.class))) != null) {
                        headers.addAll(((HeaderParam) ann).value(), value);
                    } else if ((ann = anns.get((CookieParam.class))) != null) {
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.