smartrics.rest.client
Interface RestClient

All Known Implementing Classes:
RestClientImpl

public interface RestClient

A Rest Client offers a simplified interface to an underlying implementation of an Http client. A Rest Client is geared to operate of REST resources.


Method Summary
 RestResponse execute(RestRequest request)
          Executes a rest request using the underlying Http client implementation.
 RestResponse execute(String baseUrl, RestRequest request)
          Executes the rest request.
 String getBaseUrl()
          Retrieves the previously set base Url.
 void setBaseUrl(String bUrl)
          Sets the base URL.
 

Method Detail

setBaseUrl

void setBaseUrl(String bUrl)
Sets the base URL. It is the portion of the full Url not part of the resource type. For example if a resource type full Url is http://host:8888/domain/resourcetype and the resource type is /resourcetype, the base Url is http://host:8888/domain. It is meant to serve as a default value to be appended to compose the full Url when execute(RestRequest) is used.

Parameters:
bUrl - a string with the base Url. See execute(RestRequest)

getBaseUrl

String getBaseUrl()
Retrieves the previously set base Url.

Returns:
the base Url See setBaseUrl(String)

execute

RestResponse execute(RestRequest request)
Executes a rest request using the underlying Http client implementation.

Parameters:
request - the request to be executed
Returns:
the response of the rest request

execute

RestResponse execute(String baseUrl,
                     RestRequest request)
Executes the rest request. This method offers the possibility to override the base Url set on this client.

Parameters:
baseUrl - the base Url
request - the request to be executed
Returns:
the response of the rest request. See setBaseUrl(java.lang.String)


Copyright © 2012 smartrics. All Rights Reserved.