Examples of resolveTemplate()


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

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

   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

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

        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

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

                @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

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

        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

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

                @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

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

                    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

Examples of javax.ws.rs.core.UriBuilder.resolveTemplate()

    @Test
    public void resolveTemplateTest() {
        final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{a}").path
                ("{b}").queryParam("query", "{q}");
        uriBuilder.resolveTemplate("a", "param-a");
        uriBuilder.resolveTemplate("q", "param-q");
        Map<String, Object> m = new HashMap<String, Object>();
        m.put("a", "ignored-a");
        m.put("b", "param-b");
        m.put("q", "ignored-q");
View Full Code Here

Examples of javax.ws.rs.core.UriBuilder.resolveTemplate()

    @Test
    public void resolveTemplateTest() {
        final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{a}").path
                ("{b}").queryParam("query", "{q}");
        uriBuilder.resolveTemplate("a", "param-a");
        uriBuilder.resolveTemplate("q", "param-q");
        Map<String, Object> m = new HashMap<String, Object>();
        m.put("a", "ignored-a");
        m.put("b", "param-b");
        m.put("q", "ignored-q");
        Assert.assertEquals(URI.create("http://localhost:8080/param-a/param-b?query=param-q"), uriBuilder.buildFromMap(m));
View Full Code Here

Examples of javax.ws.rs.core.UriBuilder.resolveTemplate()

    public void resolveTemplateFromEncodedTest() {
        final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{a}").path
                ("{b}").path("{c}").queryParam("query", "{q}");
        uriBuilder.resolveTemplateFromEncoded("a", "x/y/z%3F%20");
        uriBuilder.resolveTemplateFromEncoded("q", "q?%20%26");
        uriBuilder.resolveTemplate("c", "paramc1/paramc2");
        Map<String, Object> m = new HashMap<String, Object>();
        m.put("a", "ignored-a");
        m.put("b", "param-b/aaa");
        m.put("q", "ignored-q");
        Assert.assertEquals("http://localhost:8080/x/y/z%3F%20/param-b/aaa/paramc1%2Fparamc2?query=q?%20%26",
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.