protected override RestTemplate CreateRestTemplate() { RestTemplate template = new RestTemplate(); ((WebClientHttpRequestFactory) template.RequestFactory).Expect100Continue = false; IList<IHttpMessageConverter> list = new List<IHttpMessageConverter>(2); FormHttpMessageConverter item = new FormHttpMessageConverter { SupportedMediaTypes = { MediaType.ALL } }; list.Add(item); list.Add(new MsJsonHttpMessageConverter()); template.MessageConverters = list; return template; }
/// <summary> /// Creates the <see cref="RestTemplate"/> used to communicate with the provider's OAuth1 API. /// </summary> /// <remarks> /// This implementation creates a RestTemplate with a minimal set of HTTP message converters: <see cref="FormHttpMessageConverter"/>. /// May be overridden to customize how the RestTemplate is created. /// For example, if the provider returns data in some format other than JSON for form-encoded, you might override to register an appropriate message converter. /// </remarks> /// <returns>The RestTemplate used to perform OAuth1 calls.</returns> protected virtual RestTemplate CreateRestTemplate() { RestTemplate restTemplate = new RestTemplate(); //((WebClientHttpRequestFactory)this.restTemplate.RequestFactory).Expect100Continue = false; IList <IHttpMessageConverter> converters = new List <IHttpMessageConverter>(1); FormHttpMessageConverter formConverter = new FormHttpMessageConverter(); // Always read NameValueCollection as 'application/x-www-form-urlencoded' even if contentType not set properly by provider formConverter.SupportedMediaTypes.Add(MediaType.ALL); converters.Add(formConverter); restTemplate.MessageConverters = converters; return(restTemplate); }
protected virtual Maticsoft.OAuth.Rest.Client.RestTemplate CreateRestTemplate() { Maticsoft.OAuth.Rest.Client.RestTemplate template = new Maticsoft.OAuth.Rest.Client.RestTemplate(); ((WebClientHttpRequestFactory) template.RequestFactory).Expect100Continue = false; IList<IHttpMessageConverter> list = new List<IHttpMessageConverter>(2); FormHttpMessageConverter item = new FormHttpMessageConverter { SupportedMediaTypes = { MediaType.ALL } }; list.Add(item); list.Add(new SpringJsonHttpMessageConverter()); template.MessageConverters = list; return template; }
/// <summary> /// Creates the <see cref="RestTemplate"/> used to communicate with the provider's OAuth 2 API. /// </summary> /// <remarks> /// This implementation creates a RestTemplate with a minimal set of HTTP message converters: /// <see cref="FormHttpMessageConverter"/> and <see cref="SpringJsonHttpMessageConverter"/>. /// May be overridden to customize how the RestTemplate is created. /// For example, if the provider returns data in some format other than JSON for form-encoded, /// you might override to register an appropriate message converter. /// </remarks> /// <returns>The RestTemplate used to perform OAuth2 calls.</returns> protected virtual RestTemplate CreateRestTemplate() { RestTemplate restTemplate = new RestTemplate(); //((WebClientHttpRequestFactory)this.restTemplate.RequestFactory).Expect100Continue = false; IList<IHttpMessageConverter> converters = new List<IHttpMessageConverter>(2); FormHttpMessageConverter formConverter = new FormHttpMessageConverter(); // Always read NameValueCollection as 'application/x-www-form-urlencoded' even if contentType not set properly by provider formConverter.SupportedMediaTypes.Add(MediaType.ALL); converters.Add(formConverter); converters.Add(new SpringJsonHttpMessageConverter()); restTemplate.MessageConverters = converters; return restTemplate; }
public void SetUp() { converter = new FormHttpMessageConverter(); }
protected virtual Maticsoft.OAuth.Rest.Client.RestTemplate CreateRestTemplate() { Maticsoft.OAuth.Rest.Client.RestTemplate template = new Maticsoft.OAuth.Rest.Client.RestTemplate(); IList<IHttpMessageConverter> list = new List<IHttpMessageConverter>(1); FormHttpMessageConverter item = new FormHttpMessageConverter { SupportedMediaTypes = { MediaType.ALL } }; list.Add(item); template.MessageConverters = list; return template; }