Package org.jboss.resteasy.client

Examples of org.jboss.resteasy.client.ClientRequest.header()


         url = url + "." + extension;
      }
      ClientRequest request = new ClientRequest(url);
      if (accept != null)
      {
         request.header(HttpHeaderNames.ACCEPT, accept);
      }
      ClientResponse<?> response = request.get();
      assertEquals("Request for " + url + " returned a non-200 status", 200, response.getStatus());
      assertEquals("Request for " + url + " returned an unexpected content type",
              expectedContentType, response.getResponseHeaders().getFirst("Content-type"));
View Full Code Here


   @Test
   public void testMe() throws Exception
   {
      ClientRequest request = new ClientRequest(generateURL("/lang"));
      request.header("Accept-Language", "en-US;q=0,en;q=0.8,de-AT,de;q=0.9");
      Assert.assertEquals(request.get().getStatus(), 200);

   }

}
View Full Code Here

      header = delegate.fromString(str);
      Assert.assertTrue(header.getLinksByRelationship().containsKey("index"));
      Assert.assertTrue(header.getLinksByRelationship().containsKey("start"));
      Assert.assertTrue(header.getLinksByRelationship().containsKey("http://example.net/relation/other"));
      ClientRequest request = new ClientRequest(generateURL("/linkheader"));
      request.header("link", "<http://example.org/>; rel=index;" +
              "             rel=\"start http://example.net/relation/other\"");
      ClientResponse response = request.post();
      header = response.getLinkHeader();
      Assert.assertNotNull(header);
      Assert.assertTrue(header.getLinksByRelationship().containsKey("index"));
View Full Code Here

   @Test
   public void testNullJaxb() throws Exception
   {
      ClientRequest request = new ClientRequest("http://localhost:9095/my/null");
//      request.header("Content-Length", "0");
      request.header("Content-Type", "application/xml");
      ClientResponse res = request.post();
      Assert.assertEquals(400, res.getStatus());
   }

   /**
 
View Full Code Here

      String url = generateURL("/other/ppp"); // path param
      url += ";m=mmm";                        // matrix param
      url += "?q=qqq";                        // query param
      request = new ClientRequest(url);
      request.formParameter("f", "fff");      // form param
      request.header("h", "hhh");             // header param
      request.cookie(new Cookie("c", "ccc")); // cookie param
      response = request.post();
      Assert.assertEquals(204, response.getStatus());
      response.releaseConnection();
     
View Full Code Here

      url = generateURL("/other/pppp");        // path param
      url += ";m=mmmm";                        // matrix param
      url += "?q=qqqq";                        // query param
      request = new ClientRequest(url);
      request.formParameter("f", "ffff");      // form param
      request.header("h", "hhhh");             // header param
      request.cookie(new Cookie("c", "cccc")); // cookie param
      response = request.post(String.class);
      Assert.assertEquals(400, response.getStatus());
      entity = response.getEntity();
      r = new ViolationReport(String.class.cast(entity));
View Full Code Here

    */
   @Test
   public void testHtmlError() throws Exception
   {
      ClientRequest request = new ClientRequest(generateURL("/test"));
      request.header("Accept", "text/html");
      ClientResponse<String> response = request.get(String.class);
      String entity = response.getEntity();
      System.out.println("response: " + entity);
      assertEquals(500, response.getStatus());
      assertTrue(entity.contains("media type: text/html"));
View Full Code Here

      String s = writer.getBuffer().toString();
      System.out.println(s);

      ClientRequest request = new ClientRequest(url);
      request.header("Content-Type", "application/xml");
      request.body("application/xml", s);
      ClientResponse<InputStream> response = request.post(InputStream.class);
      Assert.assertEquals(200, response.getStatus());
      foo = (RealFoo) ctx.createUnmarshaller().unmarshal(response.getEntity());
      Assert.assertEquals(((RealFoo) foo).getName(), "bill");
View Full Code Here

      {
         cache.remove(request.getUri(), entry.getMediaType());
         BrowserCache.Header[] headers = entry.getValidationHeaders();
         for (BrowserCache.Header header : headers)
         {
            request.header(header.getName(), header.getValue());
         }
         return handleExpired(ctx, request, entry);
      }

      return createClientResponse(request, entry);
View Full Code Here

        }

        {

            ClientRequest request = new ClientRequest(generateURL("/entry2"));
            request.header("Accept", MediaType.APPLICATION_ATOM_XML);
            request.header("Content-Type", MediaType.APPLICATION_ATOM_XML);
            ClientResponse<Entry> response = request.get(Entry.class);
            Assert.assertEquals(200, response.getStatus());

            assertNotNull(response.getEntity().getAnyOtherJAXBObject(AtomAssetMetadata.class));
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.