37.4. Manual ClientRequest API

RESTEasy has a manual API for invoking requests: org.jboss.resteasy.client.ClientRequest See the Java Documentation for a complete description of this class. A simple example is the following:

   ClientRequest request = new ClientRequest("http://localhost:8080/some/path");
   request.header("custom-header", "value");

   // we are posting XML and a JAXB object
   request.body("application/xml", someJaxb);

   // we are expecting a String back
   ClientResponse<String> response = request.post(String.class);
   
   if (response.getStatus() == 200) // OK!
   {
      String str = response.getEntity();
   }