Skip to main content

HTTP Centric API

This API lets developers write the HTTP centric code. This fluent API makes it easy to modify the request URI, check the response status and headers. For example:

public class RESTClient {

   public void consumeRESTfulService(String baseAddress) {
      WebClient client = WebClient.create(baseAddress);
      client.type("application/xml").accept("application/xml");
      client.path("/book1");
      // get javax.ws.rs.core.Response directly and check the status, 
      // headers and read the Response.getEntity() input stream
      Response response = client.get();
      // back to the base address
      client.back(true);
      client.path("/book2");
        
      // get a typed response
      Book response = client.get(Book.class); 
   }

}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!