コード例 #1
0
 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;
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
 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;
 }
コード例 #4
0
        /// <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;
        }
コード例 #5
0
 public void SetUp()
 {
     converter = new FormHttpMessageConverter();
 }
コード例 #6
0
 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;
 }