org.apache.wink.client
Class RestClient

java.lang.Object
  extended by org.apache.wink.client.RestClient

public class RestClient
extends java.lang.Object

The RestClient is the entry point for all rest service operations. The RestClient is used to create instances of Resource classes that are used to make the actual invocations to the service. The client can be initialized with a user supplied configuration to specify custom Provider classes, in addition to other configuration options.

      // create the client
      RestClient client = new RestClient();
      
      // create the resource to make invocations on
      Resource resource = client.resource("http://myhost:80/my/service");
      
      // invoke GET on the resource and receive the response entity as a string
      String entity = resource.get(String.class);
      ...
 


Constructor Summary
RestClient()
          Construct a new RestClient using the default client configuration
RestClient(ClientConfig config)
          Construct a new RestClient using the supplied configuration
 
Method Summary
 ClientConfig getConfig()
          Get the unmodifiable client configuration
 Resource resource(java.lang.String uri)
          Create a new Resource instance
 Resource resource(java.net.URI uri)
          Create a new Resource instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestClient

public RestClient()
Construct a new RestClient using the default client configuration


RestClient

public RestClient(ClientConfig config)
Construct a new RestClient using the supplied configuration

Parameters:
config - the client configuration
Method Detail

getConfig

public ClientConfig getConfig()
Get the unmodifiable client configuration

Returns:
the unmodifiable client configuration

resource

public Resource resource(java.net.URI uri)
Create a new Resource instance

Parameters:
uri - uri of the resource to create
Returns:
a new Resource instance attached to the specified uri

resource

public Resource resource(java.lang.String uri)
Create a new Resource instance

Parameters:
uri - uri of the resource to create
Returns:
a new Resource instance attached to the specified uri


Copyright © 2009 The Apache Software Foundation. All Rights Reserved.