Package org.jboss.resteasy.client.jaxrs

Examples of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget.request()


   {
      String xml = "<collection xmlns:foo=\"http://foo.com\">"
              + "<foo:foo test=\"hello\"/></collection>";

      ResteasyWebTarget target = client.target(generateURL("/namespaced/array"));
      Response response = target.request().post(Entity.xml(xml));
      List<NamespacedFoo> list = response.readEntity(new GenericType<List<NamespacedFoo>>()
      {
      });
      Assert.assertEquals(1, list.size());
      Assert.assertEquals(list.get(0).getTest(), "hello");
View Full Code Here


                   "<collection xmlns=\"http://abc.com\">" +
                   "<favoriteMovieXmlRootElement><title>La Cage Aux Folles</title></favoriteMovieXmlRootElement>" +
                   "<favoriteMovieXmlRootElement><title>La Regle du Jeu</title></favoriteMovieXmlRootElement>" +
                   "</collection>";
      System.out.println(str);
      Response response = target.request().post(Entity.entity(str,"application/xml"));
      Assert.assertEquals(200, response.getStatus());
      String entity = response.readEntity(String.class);
      System.out.println("Result: " + entity);
      if (entity.indexOf("Cage") < entity.indexOf("Regle"))
      {
View Full Code Here

   {
      String xml = "<list xmlns:foo=\"http://foo.com\">"
              + "<foo:foo test=\"hello\"/></list>";

      ResteasyWebTarget target = client.target(generateURL("/namespaced/list"));
      Response response = target.request().post(Entity.xml(xml));
      NamespacedFoo[] list = response.readEntity(new GenericType<NamespacedFoo[]>()
      {
      });
      Assert.assertEquals(1, list.length);
      Assert.assertEquals(list[0].getTest(), "hello");
View Full Code Here

                     "<entry key=\"old\">" +
                       "<favoriteMovieXmlRootElement><title>La Regle du Jeu</title></favoriteMovieXmlRootElement>" +
                     "</entry>" +
                   "</map>";
      System.out.println(str);
      Response response = target.request().post(Entity.entity(str,"application/xml"));
      Assert.assertEquals(200, response.getStatus());
      String entity = response.readEntity(String.class);
      System.out.println("Result: " + entity);
      if (entity.indexOf("Cage") < entity.indexOf("Règle"))
      {
View Full Code Here

   {
      String xml = "<bad-list>"
              + "<foo test=\"hello\"/></bad-list>";

      ResteasyWebTarget target = client.target(generateURL("/list"));
      Response response = target.request().post(Entity.xml(xml));
      Assert.assertEquals(400, response.getStatus());
      response.close();

   }
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

   {
      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();
View Full Code Here

      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();
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

      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();
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.