Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Custom providers via JAX-RS Application
  • Handler chain
  • Proxy host & and port
  • Connect and read timeouts
  • Redirect

Handler Configuration

TBD

Code Block
xml
xml
1  ClientConfig config = new ClientConfig();

// Create new JAX-RS Application
2  config.handlers(new DummyHandler());
// create the rest client instance
3  RestClient client = new RestClient(config);
// create the resource instance to interact with
4  Resource resource = client.resource("http://services.com/HelloWorld");
// perform a GET on the resource
// the resource will be returned as plain text
5  String response = resource.accept("text/plain").get(String.class);

...

Custom Provider Configuration

TBD

Code Block
xml
xml
1  ClientConfig config = new ClientConfig();

   // Create new JAX-RS Application
2    Application app = new Application() {
     @Override
      public Set<Class<?>> getClasses() {
        HashSet<Class<?>> set = new HashSet<Class<?>>();
        set.add(FooProvider.class);
        return set;}};
3  conf.applications(app);
// create the rest client instance
4  RestClient client = new RestClient(config);
// create the resource instance to interact with
5  Resource resource = client.resource("http://services.com/HelloWorld");
// perform a GET on the resource. the resource will be returned as plain text
6  String response = resource.accept("text/plain").get(String.class);

...