OpenSim::Framework::Communications::RestClient Class Reference

Implementation of a generic REST client. More...

List of all members.

Public Member Functions

 RestClient (string url)
 Instantiate a new RestClient.
void AddResourcePath (string element)
 Add a path element to the query, e.g. assets.
void AddQueryParameter (string name, string value)
 Add a query parameter to the Url.
void AddQueryParameter (string name)
 Add a query parameter to the Url.
Stream Request ()
 Perform a synchronous request.
Stream Request (Stream src)
IAsyncResult BeginRequest (AsyncCallback callback, object state)
Stream EndRequest (IAsyncResult asyncResult)

Static Public Attributes

static ManualResetEvent _allDone = new ManualResetEvent(false)
 This flag will help block the main synchroneous method, in case we run in synchroneous mode.

Properties

string RequestMethod [get, set]
 Web-Request method, e.g. GET, PUT, POST, DELETE.


Detailed Description

Implementation of a generic REST client.

This class is a generic implementation of a REST (Representational State Transfer) web service. This class is designed to execute both synchronously and asynchronously.

Internally the implementation works as a two stage asynchronous web-client. When the request is initiated, RestClient will query asynchronously for for a web-response, sleeping until the initial response is returned by the server. Once the initial response is retrieved the second stage of asynchronous requests will be triggered, in an attempt to read of the response object into a memorystream as a sequence of asynchronous reads.

The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing other threads to execute, while it waits for a response from the web-service. RestClient itself can be invoked by the caller in either synchronous mode or asynchronous modes.


Constructor & Destructor Documentation

OpenSim::Framework::Communications::RestClient::RestClient ( string  url  )  [inline]

Instantiate a new RestClient.

Parameters:
url Web-service to query, e.g. http://osgrid.org:8003


Member Function Documentation

void OpenSim::Framework::Communications::RestClient::AddResourcePath ( string  element  )  [inline]

Add a path element to the query, e.g. assets.

Parameters:
element path entry

void OpenSim::Framework::Communications::RestClient::AddQueryParameter ( string  name,
string  value 
) [inline]

Add a query parameter to the Url.

Parameters:
name Name of the parameter, e.g. min
value Value of the parameter, e.g. 42

void OpenSim::Framework::Communications::RestClient::AddQueryParameter ( string  name  )  [inline]

Add a query parameter to the Url.

Parameters:
name Name of the parameter, e.g. min

Stream OpenSim::Framework::Communications::RestClient::Request (  )  [inline]

Perform a synchronous request.

Stream OpenSim::Framework::Communications::RestClient::Request ( Stream  src  )  [inline]

IAsyncResult OpenSim::Framework::Communications::RestClient::BeginRequest ( AsyncCallback  callback,
object  state 
) [inline]

Stream OpenSim::Framework::Communications::RestClient::EndRequest ( IAsyncResult  asyncResult  )  [inline]


Member Data Documentation

ManualResetEvent OpenSim::Framework::Communications::RestClient::_allDone = new ManualResetEvent(false) [static]

This flag will help block the main synchroneous method, in case we run in synchroneous mode.


Property Documentation

string OpenSim::Framework::Communications::RestClient::RequestMethod [get, set]

Web-Request method, e.g. GET, PUT, POST, DELETE.


The documentation for this class was generated from the following file:
Generated on Fri Jan 9 01:00:46 2009 for OpenSim by  doxygen 1.5.1