Package org.jboss.resteasy.client.jaxrs

Examples of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget


   }

  @Test(expected = RuntimeException.class)
  public void testOldBehaviorContinues() throws Exception
  {
      ResteasyWebTarget target = client.target(TestPortProvider.generateURL("/foo"));
    target.proxy(Foo.class);
  }
View Full Code Here


  }
 
  @Test
  public void testDefaultValues() throws Exception
  {
    ResteasyWebTarget target = client.target(TestPortProvider.generateURL("/foo"));
      Foo foo = target.proxyBuilder(Foo.class).defaultProduces(MediaType.TEXT_PLAIN_TYPE).defaultConsumes(MediaType.TEXT_PLAIN_TYPE).build();

    assertEquals("[text/plain]", foo.getFoo());
    assertEquals("text/plain", foo.setFoo("SOMETHING"));
  }
View Full Code Here

  @Test
  public void testMismatch() throws Exception
  {
    // NOTE: this doesn't fail on the server because the default */* provider matches the
    // requested media type.
    ResteasyWebTarget target = client.target(TestPortProvider.generateURL("/foo"));
      Foo foo = target.proxyBuilder(Foo.class).defaultProduces(MediaType.APPLICATION_JSON_TYPE).defaultConsumes(MediaType.APPLICATION_JSON_TYPE).build();

    assertEquals("[application/json]", foo.getFoo());
    assertEquals("application/json", foo.setFoo("SOMETHING"));
  }
View Full Code Here

   @Test
   public void testMe() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      ResteasyWebTarget target = client.target(generateURL("/lang"));
      Invocation.Builder request = target.request().header("Accept-Language", "en-US;q=0,en;q=0.8,de-AT,de;q=0.9");
      Assert.assertEquals(request.get().getStatus(), 200);
      client.close();

   }
View Full Code Here

   }

   @Test
  public void testSubresourceProxy() throws Exception
  {
      ResteasyWebTarget target = client.target(TestPortProvider.generateURL("/gulliverstravels"));
    Book book = target.proxy(Book.class);
   
    Assert.assertEquals("Gulliver's Travels", book.getTitle());
   
    Chapter ch1 = book.getChapter(1);
    Assert.assertEquals("Chapter 1", ch1.getTitle());
View Full Code Here

   }

   @Test
   public void testResteasy734() throws Exception
   {
      ResteasyWebTarget target = null;
      Response response = null;
           
      target = client.target("http://localhost:8081/encoded/pathparam/bee bop");
      response = target.request().get();
      String entity = response.readEntity(String.class);
      System.out.println("Received encoded path param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee%20bop", entity);
      response.close();

      target = client.target("http://localhost:8081/decoded/pathparam/bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received decoded path param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee bop", entity);
      response.close();

      target = client.target("http://localhost:8081/encoded/matrix;m=bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received encoded matrix param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee%20bop", entity);
      response.close();

      target = client.target("http://localhost:8081/decoded/matrix;m=bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received decoded matrix param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee bop", entity);
      response.close();

      target = client.target("http://localhost:8081/encoded/query?m=bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received encoded query param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee%20bop", entity);
      response.close();

      target = client.target("http://localhost:8081/decoded/query?m=bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received decoded query param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee bop", entity);
      response.close();

      target = client.target("http://localhost:8081/encoded/form");
      Form form = new Form();
      form.param("f", "bee bop");
      response = target.request().post(Entity.form(form));
      entity = response.readEntity(String.class);
      System.out.println("Received encoded form param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee+bop", entity);
      response.close();

      target = client.target("http://localhost:8081/decoded/form");
      form = new Form();
      form.param("f", "bee bop");
      response = target.request().post(Entity.form(form));
      entity = response.readEntity(String.class);
      System.out.println("Received decoded form param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee bop", entity);
      response.close();

      target = client.target("http://localhost:8081/encoded/segment/bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received encoded path param from segment: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee%20bop", entity);
      response.close();

      target = client.target("http://localhost:8081/decoded/segment/bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received decoded path param from segment: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee bop", entity);
      response.close();

      target = client.target("http://localhost:8081/encoded/segment/matrix/params;m=bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received encoded matrix param from segment: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee%20bop", entity);
      response.close();

      target = client.target("http://localhost:8081/decoded/segment/matrix/params;m=bee bop");
      response = target.request().get();
      entity = response.readEntity(String.class);
      System.out.println("Received decoded matrix param from segment: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee bop", entity);
      response.close();
View Full Code Here

   @Test
   public void lastModifiedTest() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      ResteasyWebTarget target = client.target(generateURL("/last"));
      Invocation.Builder request = target.request();
      Response response = request.get();
      System.out.println("status: " + response.getStatus());
      System.out.println("lastModified string: " + response.getHeaderString("last-modified"));
      Date last = response.getLastModified();
      System.out.println("lastModified Date:   " + DateUtil.formatDate(last));
View Full Code Here

    */
   @Test
   public void testMultiValueParam() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      ResteasyWebTarget target = client.target(generateURL("/myform/server"));
      Response response = target.request().get();
      int status = response.getStatus();
      Assert.assertEquals(200, status);
      boolean sv1 = false;
      boolean sv2 = false;
      MultivaluedMap<String, String> form = response.readEntity(new javax.ws.rs.core.GenericType<MultivaluedMap<String, String>>(){});
View Full Code Here

    */
   @Test
   public void testProxy691() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      ResteasyWebTarget target = client.target(generateBaseUrl());
      MyFormProxy proxy = target.proxy(MyFormProxy.class);
      proxy.post(null);
      client.close();
   }
View Full Code Here

   @Test
   public void testProxy() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      ResteasyWebTarget target = client.target(generateBaseUrl());
      FormClientProxy proxy = target.proxy(FormClientProxy.class);
      ClientForm form = new ClientForm();
      form.setBooleanValue(true);
      form.setName("This is My Name");
      form.setDoubleValue(123.45);
      form.setLongValue(566780L);
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget

Copyright © 2018 www.massapicom. 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.