REST client API: Use 'object' instead of 'string' for UriTemplate variables (SPRNET-1345)

This commit is contained in:
bbaia
2011-01-04 11:44:39 +00:00
parent 0c182f9945
commit d73f223a74
6 changed files with 130 additions and 130 deletions

View File

@@ -50,7 +50,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The converted object</returns>
void GetForObjectAsync<T>(string url, string[] uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class;
void GetForObjectAsync<T>(string url, object[] uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class;
/// <summary>
/// Retrieve a representation by doing a GET on the specified URL.
@@ -63,7 +63,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The converted object</returns>
void GetForObjectAsync<T>(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class;
void GetForObjectAsync<T>(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class;
/// <summary>
/// Retrieve a representation by doing a GET on the specified URL.
@@ -85,7 +85,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
void GetForMessageAsync<T>(string url, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class;
void GetForMessageAsync<T>(string url, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class;
/// <summary>
/// Retrieve an entity by doing a GET on the specified URL.
@@ -98,7 +98,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
void GetForMessageAsync<T>(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class;
void GetForMessageAsync<T>(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class;
/// <summary>
/// Retrieve an entity by doing a GET on the specified URL.
@@ -122,7 +122,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>All HTTP headers of that resource</returns>
void HeadForHeadersAsync(string url, string[] uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted);
void HeadForHeadersAsync(string url, object[] uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted);
/// <summary>
/// Retrieve all headers of the resource specified by the URI template.
@@ -133,7 +133,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>All HTTP headers of that resource</returns>
void HeadForHeadersAsync(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted);
void HeadForHeadersAsync(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted);
/// <summary>
/// Retrieve all headers of the resource specified by the URI template.
@@ -163,7 +163,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The value for the Location header.</returns>
void PostForLocationAsync(string url, object request, string[] uriVariables, Action<Uri> postCompleted);
void PostForLocationAsync(string url, object request, object[] uriVariables, Action<Uri> postCompleted);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -182,7 +182,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The value for the Location header.</returns>
void PostForLocationAsync(string url, object request, IDictionary<string, string> uriVariables, Action<Uri> postCompleted);
void PostForLocationAsync(string url, object request, IDictionary<string, object> uriVariables, Action<Uri> postCompleted);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -214,7 +214,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The converted object.</returns>
void PostForObjectAsync<T>(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class;
void PostForObjectAsync<T>(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -233,7 +233,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The converted object.</returns>
void PostForObjectAsync<T>(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class;
void PostForObjectAsync<T>(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -265,7 +265,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
void PostForMessageAsync<T>(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class;
void PostForMessageAsync<T>(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -284,7 +284,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
void PostForMessageAsync<T>(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class;
void PostForMessageAsync<T>(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -315,7 +315,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message with no entity.</returns>
void PostForMessageAsync(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted);
void PostForMessageAsync(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -333,7 +333,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message with no entity.</returns>
void PostForMessageAsync(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted);
void PostForMessageAsync(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -365,7 +365,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="request">The Object to be PUT, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
void PutAsync(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted);
void PutAsync(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted);
/// <summary>
/// Create or update a resource by PUTting the given object to the URI.
@@ -381,7 +381,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="request">The Object to be PUT, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
void PutAsync(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted);
void PutAsync(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted);
/// <summary>
/// Create or update a resource by PUTting the given object to the URI.
@@ -405,7 +405,7 @@ namespace Spring.Http.Rest
/// </remarks>
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
void DeleteAsync(string url, string[] uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted);
void DeleteAsync(string url, object[] uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted);
/// <summary>
/// Delete the resources at the specified URI.
@@ -415,7 +415,7 @@ namespace Spring.Http.Rest
/// </remarks>
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
void DeleteAsync(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted);
void DeleteAsync(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted);
/// <summary>
/// Delete the resources at the specified URI.
@@ -436,7 +436,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The value of the allow header.</returns>
void OptionsForAllowAsync(string url, string[] uriVariables, Action<IList<HttpMethod>> optionsCompleted);
void OptionsForAllowAsync(string url, object[] uriVariables, Action<IList<HttpMethod>> optionsCompleted);
/// <summary>
/// Return the value of the Allow header for the given URI.
@@ -447,7 +447,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The value of the allow header.</returns>
void OptionsForAllowAsync(string url, IDictionary<string, string> uriVariables, Action<IList<HttpMethod>> optionsCompleted);
void OptionsForAllowAsync(string url, IDictionary<string, object> uriVariables, Action<IList<HttpMethod>> optionsCompleted);
/// <summary>
/// Return the value of the Allow header for the given URI.
@@ -476,7 +476,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class;
void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -493,7 +493,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class;
void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -522,7 +522,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message with no entity.</returns>
void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted);
void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted);
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -538,7 +538,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message with no entity.</returns>
void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted);
void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted);
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -570,7 +570,7 @@ namespace Spring.Http.Rest
/// <param name="responseExtractor">Object that extracts the return value from the response.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>An arbitrary object, as returned by the <see cref="IResponseExtractor{T}"/>.</returns>
void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, string[] uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class;
void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, object[] uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, preparing the request with the
@@ -586,7 +586,7 @@ namespace Spring.Http.Rest
/// <param name="responseExtractor">Object that extracts the return value from the response.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>An arbitrary object, as returned by the <see cref="IResponseExtractor{T}"/>.</returns>
void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class;
void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, preparing the request with the

View File

@@ -54,7 +54,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The converted object</returns>
T GetForObject<T>(string url, params string[] uriVariables) where T : class;
T GetForObject<T>(string url, params object[] uriVariables) where T : class;
/// <summary>
/// Retrieve a representation by doing a GET on the specified URL.
@@ -67,7 +67,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The converted object</returns>
T GetForObject<T>(string url, IDictionary<string, string> uriVariables) where T : class;
T GetForObject<T>(string url, IDictionary<string, object> uriVariables) where T : class;
/// <summary>
/// Retrieve a representation by doing a GET on the specified URL.
@@ -89,7 +89,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
HttpResponseMessage<T> GetForMessage<T>(string url, params string[] uriVariables) where T : class;
HttpResponseMessage<T> GetForMessage<T>(string url, params object[] uriVariables) where T : class;
/// <summary>
/// Retrieve an entity by doing a GET on the specified URL.
@@ -102,7 +102,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
HttpResponseMessage<T> GetForMessage<T>(string url, IDictionary<string, string> uriVariables) where T : class;
HttpResponseMessage<T> GetForMessage<T>(string url, IDictionary<string, object> uriVariables) where T : class;
/// <summary>
/// Retrieve an entity by doing a GET on the specified URL.
@@ -126,7 +126,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>All HTTP headers of that resource</returns>
HttpHeaders HeadForHeaders(string url, params string[] uriVariables);
HttpHeaders HeadForHeaders(string url, params object[] uriVariables);
/// <summary>
/// Retrieve all headers of the resource specified by the URI template.
@@ -137,7 +137,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>All HTTP headers of that resource</returns>
HttpHeaders HeadForHeaders(string url, IDictionary<string, string> uriVariables);
HttpHeaders HeadForHeaders(string url, IDictionary<string, object> uriVariables);
/// <summary>
/// Retrieve all headers of the resource specified by the URI template.
@@ -167,7 +167,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The value for the Location header.</returns>
Uri PostForLocation(string url, object request, params string[] uriVariables);
Uri PostForLocation(string url, object request, params object[] uriVariables);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -186,7 +186,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The value for the Location header.</returns>
Uri PostForLocation(string url, object request, IDictionary<string, string> uriVariables);
Uri PostForLocation(string url, object request, IDictionary<string, object> uriVariables);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -218,7 +218,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The converted object.</returns>
T PostForObject<T>(string url, object request, params string[] uriVariables) where T : class;
T PostForObject<T>(string url, object request, params object[] uriVariables) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -237,7 +237,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The converted object.</returns>
T PostForObject<T>(string url, object request, IDictionary<string, string> uriVariables) where T : class;
T PostForObject<T>(string url, object request, IDictionary<string, object> uriVariables) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -269,7 +269,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
HttpResponseMessage<T> PostForMessage<T>(string url, object request, params string[] uriVariables) where T : class;
HttpResponseMessage<T> PostForMessage<T>(string url, object request, params object[] uriVariables) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -288,7 +288,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
HttpResponseMessage<T> PostForMessage<T>(string url, object request, IDictionary<string, string> uriVariables) where T : class;
HttpResponseMessage<T> PostForMessage<T>(string url, object request, IDictionary<string, object> uriVariables) where T : class;
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -319,7 +319,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message with no entity.</returns>
HttpResponseMessage PostForMessage(string url, object request, params string[] uriVariables);
HttpResponseMessage PostForMessage(string url, object request, params object[] uriVariables);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -337,7 +337,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message with no entity.</returns>
HttpResponseMessage PostForMessage(string url, object request, IDictionary<string, string> uriVariables);
HttpResponseMessage PostForMessage(string url, object request, IDictionary<string, object> uriVariables);
/// <summary>
/// Create a new resource by POSTing the given object to the URI template,
@@ -369,7 +369,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="request">The Object to be PUT, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
void Put(string url, object request, params string[] uriVariables);
void Put(string url, object request, params object[] uriVariables);
/// <summary>
/// Create or update a resource by PUTting the given object to the URI.
@@ -385,7 +385,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="request">The Object to be PUT, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
void Put(string url, object request, IDictionary<string, string> uriVariables);
void Put(string url, object request, IDictionary<string, object> uriVariables);
/// <summary>
/// Create or update a resource by PUTting the given object to the URI.
@@ -409,7 +409,7 @@ namespace Spring.Http.Rest
/// </remarks>
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
void Delete(string url, params string[] uriVariables);
void Delete(string url, params object[] uriVariables);
/// <summary>
/// Delete the resources at the specified URI.
@@ -419,7 +419,7 @@ namespace Spring.Http.Rest
/// </remarks>
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
void Delete(string url, IDictionary<string, string> uriVariables);
void Delete(string url, IDictionary<string, object> uriVariables);
/// <summary>
/// Delete the resources at the specified URI.
@@ -440,7 +440,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The value of the allow header.</returns>
IList<HttpMethod> OptionsForAllow(string url, params string[] uriVariables);
IList<HttpMethod> OptionsForAllow(string url, params object[] uriVariables);
/// <summary>
/// Return the value of the Allow header for the given URI.
@@ -451,7 +451,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The value of the allow header.</returns>
IList<HttpMethod> OptionsForAllow(string url, IDictionary<string, string> uriVariables);
IList<HttpMethod> OptionsForAllow(string url, IDictionary<string, object> uriVariables);
/// <summary>
/// Return the value of the Allow header for the given URI.
@@ -480,7 +480,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, params string[] uriVariables) where T : class;
HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, params object[] uriVariables) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -497,7 +497,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables) where T : class;
HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -526,7 +526,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message with no entity.</returns>
HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, params string[] uriVariables);
HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, params object[] uriVariables);
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -542,7 +542,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message with no entity.</returns>
HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables);
HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables);
/// <summary>
/// Execute the HTTP method to the given URI template, writing the given request message to the request,
@@ -574,7 +574,7 @@ namespace Spring.Http.Rest
/// <param name="responseExtractor">Object that extracts the return value from the response.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>An arbitrary object, as returned by the <see cref="IResponseExtractor{T}"/>.</returns>
T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, params string[] uriVariables) where T : class;
T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, params object[] uriVariables) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, preparing the request with the
@@ -590,7 +590,7 @@ namespace Spring.Http.Rest
/// <param name="responseExtractor">Object that extracts the return value from the response.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>An arbitrary object, as returned by the <see cref="IResponseExtractor{T}"/>.</returns>
T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, string> uriVariables) where T : class;
T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, object> uriVariables) where T : class;
/// <summary>
/// Execute the HTTP method to the given URI template, preparing the request with the

View File

@@ -268,7 +268,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The converted object</returns>
public T GetForObject<T>(string url, params string[] uriVariables) where T : class
public T GetForObject<T>(string url, params object[] uriVariables) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
@@ -286,7 +286,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The converted object</returns>
public T GetForObject<T>(string url, IDictionary<string, string> uriVariables) where T : class
public T GetForObject<T>(string url, IDictionary<string, object> uriVariables) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
@@ -318,7 +318,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
public HttpResponseMessage<T> GetForMessage<T>(string url, params string[] uriVariables) where T : class
public HttpResponseMessage<T> GetForMessage<T>(string url, params object[] uriVariables) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -336,7 +336,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
public HttpResponseMessage<T> GetForMessage<T>(string url, IDictionary<string, string> uriVariables) where T : class
public HttpResponseMessage<T> GetForMessage<T>(string url, IDictionary<string, object> uriVariables) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -370,7 +370,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>All HTTP headers of that resource</returns>
public HttpHeaders HeadForHeaders(string url, params string[] uriVariables)
public HttpHeaders HeadForHeaders(string url, params object[] uriVariables)
{
return this.Execute<HttpHeaders>(url, HttpMethod.HEAD, null, this.headersExtractor, uriVariables);
}
@@ -384,7 +384,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>All HTTP headers of that resource</returns>
public HttpHeaders HeadForHeaders(string url, IDictionary<string, string> uriVariables)
public HttpHeaders HeadForHeaders(string url, IDictionary<string, object> uriVariables)
{
return this.Execute<HttpHeaders>(url, HttpMethod.HEAD, null, this.headersExtractor, uriVariables);
}
@@ -420,7 +420,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The value for the Location header.</returns>
public Uri PostForLocation(string url, object request, params string[] uriVariables)
public Uri PostForLocation(string url, object request, params object[] uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
HttpHeaders headers = this.Execute<HttpHeaders>(
@@ -445,7 +445,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The value for the Location header.</returns>
public Uri PostForLocation(string url, object request, IDictionary<string, string> uriVariables)
public Uri PostForLocation(string url, object request, IDictionary<string, object> uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
HttpHeaders headers = this.Execute<HttpHeaders>(
@@ -489,7 +489,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The converted object.</returns>
public T PostForObject<T>(string url, object request, params string[] uriVariables) where T : class
public T PostForObject<T>(string url, object request, params object[] uriVariables) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
@@ -513,7 +513,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The converted object.</returns>
public T PostForObject<T>(string url, object request, IDictionary<string, string> uriVariables) where T : class
public T PostForObject<T>(string url, object request, IDictionary<string, object> uriVariables) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
@@ -555,7 +555,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
public HttpResponseMessage<T> PostForMessage<T>(string url, object request, params string[] uriVariables) where T : class
public HttpResponseMessage<T> PostForMessage<T>(string url, object request, params object[] uriVariables) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -579,7 +579,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
public HttpResponseMessage<T> PostForMessage<T>(string url, object request, IDictionary<string, string> uriVariables) where T : class
public HttpResponseMessage<T> PostForMessage<T>(string url, object request, IDictionary<string, object> uriVariables) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -620,7 +620,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message with no entity.</returns>
public HttpResponseMessage PostForMessage(string url, object request, params string[] uriVariables)
public HttpResponseMessage PostForMessage(string url, object request, params object[] uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
@@ -643,7 +643,7 @@ namespace Spring.Http.Rest
/// <param name="request">The Object to be POSTed, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message with no entity.</returns>
public HttpResponseMessage PostForMessage(string url, object request, IDictionary<string, string> uriVariables)
public HttpResponseMessage PostForMessage(string url, object request, IDictionary<string, object> uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
@@ -685,7 +685,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="request">The Object to be PUT, may be null.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
public void Put(string url, object request, params string[] uriVariables)
public void Put(string url, object request, params object[] uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
this.Execute<object>(url, HttpMethod.PUT, requestCallback, null, uriVariables);
@@ -705,7 +705,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="request">The Object to be PUT, may be null.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
public void Put(string url, object request, IDictionary<string, string> uriVariables)
public void Put(string url, object request, IDictionary<string, object> uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
this.Execute<object>(url, HttpMethod.PUT, requestCallback, null, uriVariables);
@@ -737,7 +737,7 @@ namespace Spring.Http.Rest
/// </remarks>
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
public void Delete(string url, params string[] uriVariables)
public void Delete(string url, params object[] uriVariables)
{
this.Execute<object>(url, HttpMethod.DELETE, null, null, uriVariables);
}
@@ -750,7 +750,7 @@ namespace Spring.Http.Rest
/// </remarks>
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
public void Delete(string url, IDictionary<string, string> uriVariables)
public void Delete(string url, IDictionary<string, object> uriVariables)
{
this.Execute<object>(url, HttpMethod.DELETE, null, null, uriVariables);
}
@@ -777,7 +777,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The value of the allow header.</returns>
public IList<HttpMethod> OptionsForAllow(string url, params string[] uriVariables)
public IList<HttpMethod> OptionsForAllow(string url, params object[] uriVariables)
{
HttpHeaders headers = this.Execute<HttpHeaders>(
url, HttpMethod.OPTIONS, null, this.headersExtractor, uriVariables);
@@ -793,7 +793,7 @@ namespace Spring.Http.Rest
/// <param name="url">The URL.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The value of the allow header.</returns>
public IList<HttpMethod> OptionsForAllow(string url, IDictionary<string, string> uriVariables)
public IList<HttpMethod> OptionsForAllow(string url, IDictionary<string, object> uriVariables)
{
HttpHeaders headers = this.Execute<HttpHeaders>(
url, HttpMethod.OPTIONS, null, this.headersExtractor, uriVariables);
@@ -832,7 +832,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message.</returns>
public HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, params string[] uriVariables) where T : class
public HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, params object[] uriVariables) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -854,7 +854,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message.</returns>
public HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables) where T : class
public HttpResponseMessage<T> Exchange<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -893,7 +893,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>The HTTP response message with no entity.</returns>
public HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, params string[] uriVariables)
public HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, params object[] uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
@@ -914,7 +914,7 @@ namespace Spring.Http.Rest
/// </param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>The HTTP response message with no entity.</returns>
public HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables)
public HttpResponseMessage Exchange(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
@@ -956,7 +956,7 @@ namespace Spring.Http.Rest
/// <param name="responseExtractor">Object that extracts the return value from the response.</param>
/// <param name="uriVariables">The variables to expand the template.</param>
/// <returns>An arbitrary object, as returned by the <see cref="IResponseExtractor{T}"/>.</returns>
public T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, params string[] uriVariables) where T : class
public T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, params object[] uriVariables) where T : class
{
return this.DoExecute<T>(this.BuildUri(this._baseAddress, url, uriVariables), method, requestCallback, responseExtractor);
}
@@ -975,7 +975,7 @@ namespace Spring.Http.Rest
/// <param name="responseExtractor">Object that extracts the return value from the response.</param>
/// <param name="uriVariables">The dictionary containing variables for the URI template.</param>
/// <returns>An arbitrary object, as returned by the <see cref="IResponseExtractor{T}"/>.</returns>
public T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, string> uriVariables) where T : class
public T Execute<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, object> uriVariables) where T : class
{
return this.DoExecute<T>(this.BuildUri(this._baseAddress, url, uriVariables), method, requestCallback, responseExtractor);
}
@@ -1004,14 +1004,14 @@ namespace Spring.Http.Rest
#region GET
public void GetForObjectAsync<T>(string url, string[] uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class
public void GetForObjectAsync<T>(string url, object[] uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
this.ExecuteAsync<T>(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables, getCompleted);
}
public void GetForObjectAsync<T>(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class
public void GetForObjectAsync<T>(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<T>> getCompleted) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
@@ -1025,14 +1025,14 @@ namespace Spring.Http.Rest
this.ExecuteAsync<T>(url, HttpMethod.GET, requestCallback, responseExtractor, getCompleted);
}
public void GetForMessageAsync<T>(string url, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class
public void GetForMessageAsync<T>(string url, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
this.ExecuteAsync<HttpResponseMessage<T>>(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables, getCompleted);
}
public void GetForMessageAsync<T>(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class
public void GetForMessageAsync<T>(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> getCompleted) where T : class
{
AcceptHeaderRequestCallback requestCallback = new AcceptHeaderRequestCallback(typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -1050,12 +1050,12 @@ namespace Spring.Http.Rest
#region HEAD
public void HeadForHeadersAsync(string url, string[] uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted)
public void HeadForHeadersAsync(string url, object[] uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted)
{
this.ExecuteAsync<HttpHeaders>(url, HttpMethod.HEAD, null, this.headersExtractor, uriVariables, headCompleted);
}
public void HeadForHeadersAsync(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted)
public void HeadForHeadersAsync(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpHeaders>> headCompleted)
{
this.ExecuteAsync<HttpHeaders>(url, HttpMethod.HEAD, null, this.headersExtractor, uriVariables, headCompleted);
}
@@ -1069,7 +1069,7 @@ namespace Spring.Http.Rest
#region POST
public void PostForLocationAsync(string url, object request, string[] uriVariables, Action<Uri> postCompleted)
public void PostForLocationAsync(string url, object request, object[] uriVariables, Action<Uri> postCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
this.ExecuteAsync<HttpHeaders>(url, HttpMethod.POST, requestCallback, this.headersExtractor, uriVariables,
@@ -1079,7 +1079,7 @@ namespace Spring.Http.Rest
});
}
public void PostForLocationAsync(string url, object request, IDictionary<string, string> uriVariables, Action<Uri> postCompleted)
public void PostForLocationAsync(string url, object request, IDictionary<string, object> uriVariables, Action<Uri> postCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
this.ExecuteAsync<HttpHeaders>(url, HttpMethod.POST, requestCallback, this.headersExtractor, uriVariables,
@@ -1099,14 +1099,14 @@ namespace Spring.Http.Rest
});
}
public void PostForObjectAsync<T>(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class
public void PostForObjectAsync<T>(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
this.ExecuteAsync<T>(url, HttpMethod.POST, requestCallback, responseExtractor, uriVariables, postCompleted);
}
public void PostForObjectAsync<T>(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class
public void PostForObjectAsync<T>(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<T>> postCompleted) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
MessageConverterResponseExtractor<T> responseExtractor = new MessageConverterResponseExtractor<T>(this._messageConverters);
@@ -1120,14 +1120,14 @@ namespace Spring.Http.Rest
this.ExecuteAsync<T>(url, HttpMethod.POST, requestCallback, responseExtractor, postCompleted);
}
public void PostForMessageAsync<T>(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class
public void PostForMessageAsync<T>(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
this.ExecuteAsync<HttpResponseMessage<T>>(url, HttpMethod.POST, requestCallback, responseExtractor, uriVariables, postCompleted);
}
public void PostForMessageAsync<T>(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class
public void PostForMessageAsync<T>(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> postCompleted) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -1141,14 +1141,14 @@ namespace Spring.Http.Rest
this.ExecuteAsync<HttpResponseMessage<T>>(url, HttpMethod.POST, requestCallback, responseExtractor, postCompleted);
}
public void PostForMessageAsync(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted)
public void PostForMessageAsync(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
this.ExecuteAsync<HttpResponseMessage>(url, HttpMethod.POST, requestCallback, responseExtractor, uriVariables, postCompleted);
}
public void PostForMessageAsync(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted)
public void PostForMessageAsync(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> postCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
@@ -1166,13 +1166,13 @@ namespace Spring.Http.Rest
#region PUT
public void PutAsync(string url, object request, string[] uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted)
public void PutAsync(string url, object request, object[] uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
this.ExecuteAsync<object>(url, HttpMethod.PUT, requestCallback, null, uriVariables, putCompleted);
}
public void PutAsync(string url, object request, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted)
public void PutAsync(string url, object request, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<object>> putCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(request, this._messageConverters);
this.ExecuteAsync<object>(url, HttpMethod.PUT, requestCallback, null, uriVariables, putCompleted);
@@ -1188,12 +1188,12 @@ namespace Spring.Http.Rest
#region DELETE
public void DeleteAsync(string url, string[] uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted)
public void DeleteAsync(string url, object[] uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted)
{
this.ExecuteAsync<object>(url, HttpMethod.DELETE, null, null, uriVariables, deleteCompleted);
}
public void DeleteAsync(string url, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted)
public void DeleteAsync(string url, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<object>> deleteCompleted)
{
this.ExecuteAsync<object>(url, HttpMethod.DELETE, null, null, uriVariables, deleteCompleted);
}
@@ -1207,7 +1207,7 @@ namespace Spring.Http.Rest
#region OPTIONS
public void OptionsForAllowAsync(string url, string[] uriVariables, Action<IList<HttpMethod>> optionsCompleted)
public void OptionsForAllowAsync(string url, object[] uriVariables, Action<IList<HttpMethod>> optionsCompleted)
{
this.ExecuteAsync<HttpHeaders>(url, HttpMethod.OPTIONS, null, this.headersExtractor, uriVariables,
delegate(MethodCompletedEventArgs<HttpHeaders> args)
@@ -1216,7 +1216,7 @@ namespace Spring.Http.Rest
});
}
public void OptionsForAllowAsync(string url, IDictionary<string, string> uriVariables, Action<IList<HttpMethod>> optionsCompleted)
public void OptionsForAllowAsync(string url, IDictionary<string, object> uriVariables, Action<IList<HttpMethod>> optionsCompleted)
{
this.ExecuteAsync<HttpHeaders>(url, HttpMethod.OPTIONS, null, this.headersExtractor, uriVariables,
delegate(MethodCompletedEventArgs<HttpHeaders> args)
@@ -1239,14 +1239,14 @@ namespace Spring.Http.Rest
#region Exchange
public void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class
public void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
this.ExecuteAsync<HttpResponseMessage<T>>(url, method, requestCallback, responseExtractor, uriVariables, methodCompleted);
}
public void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class
public void ExchangeAsync<T>(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage<T>>> methodCompleted) where T : class
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, typeof(T), this._messageConverters);
HttpMessageResponseExtractor<T> responseExtractor = new HttpMessageResponseExtractor<T>(this._messageConverters);
@@ -1260,14 +1260,14 @@ namespace Spring.Http.Rest
this.ExecuteAsync<HttpResponseMessage<T>>(url, method, requestCallback, responseExtractor, methodCompleted);
}
public void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, string[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted)
public void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, object[] uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
this.ExecuteAsync<HttpResponseMessage>(url, method, requestCallback, responseExtractor, uriVariables, methodCompleted);
}
public void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted)
public void ExchangeAsync(string url, HttpMethod method, HttpEntity requestEntity, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<HttpResponseMessage>> methodCompleted)
{
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, this._messageConverters);
HttpMessageResponseExtractor responseExtractor = new HttpMessageResponseExtractor();
@@ -1285,13 +1285,13 @@ namespace Spring.Http.Rest
#region General execution
public void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, string[] uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class
public void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, object[] uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class
{
this.DoExecuteAsync<T>(BuildUri(this._baseAddress, url, uriVariables), method,
requestCallback, responseExtractor, methodCompleted);
}
public void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, string> uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class
public void ExecuteAsync<T>(string url, HttpMethod method, IRequestCallback requestCallback, IResponseExtractor<T> responseExtractor, IDictionary<string, object> uriVariables, Action<MethodCompletedEventArgs<T>> methodCompleted) where T : class
{
this.DoExecuteAsync<T>(BuildUri(this._baseAddress, url, uriVariables), method,
requestCallback, responseExtractor, methodCompleted);
@@ -1448,14 +1448,14 @@ namespace Spring.Http.Rest
// - UriTemplate.BindByPosition is not supported in Silverlight
// - UriTemplate class is not included in the Silverlight core dlls
protected virtual Uri BuildUri(Uri baseAddress, string url, string[] uriVariables)
protected virtual Uri BuildUri(Uri baseAddress, string url, object[] uriVariables)
{
UriTemplate uriTemplate = new UriTemplate(url);
Uri uri = uriTemplate.Expand(uriVariables);
return BuildUri(baseAddress, uri);
}
protected virtual Uri BuildUri(Uri baseAddress, string url, IDictionary<string, string> uriVariables)
protected virtual Uri BuildUri(Uri baseAddress, string url, IDictionary<string, object> uriVariables)
{
UriTemplate uriTemplate = new UriTemplate(url);
Uri uri = uriTemplate.Expand(uriVariables);

View File

@@ -79,16 +79,16 @@ namespace Spring.Util
/// <example>
/// <code>
/// UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
/// IDictionary&lt;string, string&gt; uriVariables = new Dictionary&lt;String, String&gt;();
/// IDictionary&lt;string, object&gt; uriVariables = new Dictionary&lt;string, object&gt;();
/// uriVariables.Add("booking", "42");
/// uriVariables.Add("hotel", "1");
/// uriVariables.Add("hotel", 1);
/// Console.Out.WriteLine(template.Expand(uriVariables));
/// </code>
/// will print: <blockquote>http://example.com/hotels/1/bookings/42</blockquote>
/// </example>
/// <param name="uriVariables">The dictionary of URI variables.</param>
/// <returns>The expanded URI</returns>
public Uri Expand(IDictionary<string, string> uriVariables)
public Uri Expand(IDictionary<string, object> uriVariables)
{
if (uriVariables.Count != this.variableNames.Length)
{
@@ -119,13 +119,13 @@ namespace Spring.Util
/// <example>
/// <code>
/// UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
/// Console.Out.WriteLine(template.Expand("1", "42"));
/// Console.Out.WriteLine(template.Expand(1, "42"));
/// </code>
/// will print: <blockquote>http://example.com/hotels/1/bookings/42</blockquote>
/// </example>
/// <param name="uriVariableValues">The array of URI variables.</param>
/// <returns>The expanded URI</returns>
public Uri Expand(params string[] uriVariableValues)
public Uri Expand(params object[] uriVariableValues)
{
if (uriVariableValues.Length != this.variableNames.Length)
{
@@ -194,10 +194,10 @@ namespace Spring.Util
return this.uriTemplate;
}
private static string Replace(string uriTemplate, string token, string value)
private static string Replace(string uriTemplate, string token, object value)
{
string quotedToken = BRACE_LEFT + token + BRACE_RIGHT;
return uriTemplate.Replace(quotedToken, value);
return uriTemplate.Replace(quotedToken, (value == null) ? String.Empty : value.ToString());
}
// Static inner class to parse uri template strings into a matching regular expression.

View File

@@ -77,15 +77,15 @@ namespace Spring.Http.Rest
[Test]
public void GetStringVarArgsTemplateVariables()
{
string result = template.GetForObject<string>("user/{id}", "1");
string result = template.GetForObject<string>("user/{id}", 1);
Assert.AreEqual("Bruno Baïa", result, "Invalid content");
}
[Test]
public void GetStringDictionaryTemplateVariables()
{
IDictionary<string, string> uriVariables = new Dictionary<string, string>(1);
uriVariables.Add("id", "2");
IDictionary<string, object> uriVariables = new Dictionary<string, object>(1);
uriVariables.Add("id", 2);
string result = template.GetForObject<string>("user/{id}", uriVariables);
Assert.AreEqual("Marie Baia", result, "Invalid content");
}
@@ -95,13 +95,13 @@ namespace Spring.Http.Rest
ExpectedMessage = "The server returned 'User with id '5' not found' with the status code 404 - NotFound.")]
public void GetStringError()
{
string result = template.GetForObject<string>("user/{id}", "5");
string result = template.GetForObject<string>("user/{id}", 5);
}
[Test]
public void GetStringForMessage()
{
HttpResponseMessage<string> result = template.GetForMessage<string>("user/{id}", "1");
HttpResponseMessage<string> result = template.GetForMessage<string>("user/{id}", 1);
Assert.AreEqual("Bruno Baïa", result.Body, "Invalid content");
Assert.AreEqual(contentType, result.Headers.ContentType, "Invalid content-type");
Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Invalid status code");

View File

@@ -60,8 +60,8 @@ namespace Spring.Util
public void MultipleExpandVarArgs()
{
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
Uri result = template.Expand("2", "21");
result = template.Expand("1", "42");
Uri result = template.Expand("2", 21);
result = template.Expand(1, "42");
Assert.AreEqual(new Uri("http://example.com/hotels/1/bookings/42"), result, "Invalid expanded template");
}
@@ -72,7 +72,7 @@ namespace Spring.Util
public void ExpandVarArgsInvalidAmountVariables()
{
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
template.Expand("1", "42", "100");
template.Expand("1", "42", 100);
}
[Test]
@@ -87,9 +87,9 @@ namespace Spring.Util
[Test]
public void ExpandDictionary()
{
IDictionary<string, string> uriVariables = new Dictionary<String, String>(2);
IDictionary<string, object> uriVariables = new Dictionary<string, object>(2);
uriVariables.Add("booking", "42");
uriVariables.Add("hotel", "1");
uriVariables.Add("hotel", 1);
// absolute
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
@@ -107,12 +107,12 @@ namespace Spring.Util
{
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
IDictionary<string, string> uriVariables = new Dictionary<String, String>(2);
uriVariables.Add("booking", "21");
IDictionary<string, object> uriVariables = new Dictionary<string, object>(2);
uriVariables.Add("booking", 21);
uriVariables.Add("hotel", "2");
Uri result = template.Expand(uriVariables);
uriVariables = new Dictionary<String, String>(2);
uriVariables = new Dictionary<string, object>(2);
uriVariables.Add("booking", "42");
uriVariables.Add("hotel", "1");
result = template.Expand(uriVariables);
@@ -126,8 +126,8 @@ namespace Spring.Util
ExpectedMessage = "Invalid amount of variables values in 'http://example.com/hotels/{hotel}/bookings/{booking}': expected 2; got 1")]
public void ExpandDictionaryInvalidAmountVariables()
{
IDictionary<string, string> uriVariables = new Dictionary<String, String>(2);
uriVariables.Add("hotel", "1");
IDictionary<string, object> uriVariables = new Dictionary<string, object>(2);
uriVariables.Add("hotel", 1);
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
template.Expand(uriVariables);
@@ -139,9 +139,9 @@ namespace Spring.Util
ExpectedMessage = "'uriVariables' dictionary has no value for 'hotel'")]
public void ExpandDictionaryUnboundVariables()
{
IDictionary<string, string> uriVariables = new Dictionary<String, String>(2);
IDictionary<string, object> uriVariables = new Dictionary<string, object>(2);
uriVariables.Add("booking", "42");
uriVariables.Add("bar", "1");
uriVariables.Add("bar", 1);
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
template.Expand(uriVariables);