public static System.Data.Services.Http.WebRequest Create(Uri requestUri, HttpStack httpStack) { Debug.Assert(requestUri != null, "requestUri != null"); if ((requestUri.Scheme != Uri.UriSchemeHttp) && (requestUri.Scheme != Uri.UriSchemeHttps)) { throw new NotSupportedException(); } if (httpStack == HttpStack.Auto) { if (UriRequiresClientHttpWebRequest(requestUri)) { httpStack = HttpStack.ClientHttp; } else { httpStack = HttpStack.XmlHttp; } } if (httpStack == HttpStack.ClientHttp) { return new ClientHttpWebRequest(requestUri); } else { Debug.Assert(httpStack == HttpStack.XmlHttp, "Only ClientHttp and XmlHttp are supported for now."); return new XHRHttpWebRequest(requestUri); } }
public static Microsoft.OData.Service.Http.WebRequest Create(Uri requestUri, HttpStack httpStack) { Debug.Assert(requestUri != null, "requestUri != null"); if ((requestUri.Scheme != PlatformHelper.UriSchemeHttp) && (requestUri.Scheme != PlatformHelper.UriSchemeHttps)) { // "SR.GetString(SR.net_unknown_prefix)" throw new NotSupportedException(); } #if !WINDOWS_PHONE && !PORTABLELIB if (httpStack == HttpStack.Auto) { if (UriRequiresClientHttpWebRequest(requestUri)) { httpStack = HttpStack.ClientHttp; } else { httpStack = HttpStack.XmlHttp; } } if (httpStack == HttpStack.ClientHttp) { return(new ClientHttpWebRequest(requestUri)); } else { Debug.Assert(httpStack == HttpStack.XmlHttp, "Only ClientHttp and XmlHttp are supported for now."); return(new XHRHttpWebRequest(requestUri)); } #else return(new ClientHttpWebRequest(requestUri)); #endif }
public static System.Data.Services.Http.WebRequest Create(Uri requestUri, HttpStack httpStack) { Debug.Assert(requestUri != null, "requestUri != null"); if ((requestUri.Scheme != Uri.UriSchemeHttp) && (requestUri.Scheme != Uri.UriSchemeHttps)) { throw new NotSupportedException(); } if (httpStack == HttpStack.Auto) { if (UriRequiresClientHttpWebRequest(requestUri)) { httpStack = HttpStack.ClientHttp; } else { httpStack = HttpStack.XmlHttp; } } if (httpStack == HttpStack.ClientHttp) { return(new ClientHttpWebRequest(requestUri)); } else { Debug.Assert(httpStack == HttpStack.XmlHttp, "Only ClientHttp and XmlHttp are supported for now."); return(new XHRHttpWebRequest(requestUri)); } }
public ProxyCommunicator(ICoapConfig config) { _coapStack = new CoapStack(config); _httpStack = new HttpStack(config.HttpPort); _coapStack.RegisterReceiver(this); _httpStack.RegisterReceiver(this); }
/// <summary> /// Initializes a new instance of the <see cref="BuildingRequestEventArgs"/> class. /// </summary> /// <param name="method">The method.</param> /// <param name="requestUri">The request URI.</param> /// <param name="headers">The request headers.</param> /// <param name="descriptor">Descriptor for this request; or null if there isn't one.</param> /// <param name="httpStack">The http stack.</param> internal BuildingRequestEventArgs(string method, Uri requestUri, HeaderCollection headers, Descriptor descriptor, HttpStack httpStack) { this.Method = method; this.RequestUri = requestUri; this.HeaderCollection = headers ?? new HeaderCollection(); this.ClientHttpStack = httpStack; this.Descriptor = descriptor; }
public static Microsoft.WindowsAzure.Samples.Data.Services.Client.WebRequest Create(Uri requestUri, HttpStack httpStack) { Debug.Assert(requestUri != null, "requestUri != null"); if ((requestUri.Scheme != Uri.UriSchemeHttp) && (requestUri.Scheme != Uri.UriSchemeHttps)) { throw new NotSupportedException(); } return new ClientHttpWebRequest(requestUri); }
/// <summary> /// Validate HttpStack /// </summary> /// <param name="value">option to validate</param> /// <param name="parameterName">name of the parameter being validated</param> /// <exception cref="System.ArgumentOutOfRangeException">if option is not valid</exception> /// <returns>option</returns> internal static HttpStack CheckEnumerationValue(HttpStack value, string parameterName) { switch (value) { case HttpStack.Auto: return(value); default: throw Error.ArgumentOutOfRange(parameterName); } }
/// <summary> /// Validate HttpStack /// </summary> /// <param name="value">option to validate</param> /// <param name="parameterName">name of the parameter being validated</param> /// <exception cref="System.ArgumentOutOfRangeException">if option is not valid</exception> /// <returns>option</returns> internal static HttpStack CheckEnumerationValue(HttpStack value, string parameterName) { switch (value) { case HttpStack.Auto: #if ASTORIA_LIGHT case HttpStack.ClientHttp: case HttpStack.XmlHttp: #endif return(value); default: throw Error.ArgumentOutOfRange(parameterName); } }
public static WebRequest Create(Uri requestUri, HttpStack httpStack) { if ((requestUri.Scheme != Uri.UriSchemeHttp) && (requestUri.Scheme != Uri.UriSchemeHttps)) { throw new NotSupportedException(); } if (httpStack == HttpStack.Auto) { if (UriRequiresClientHttpWebRequest(requestUri)) { httpStack = HttpStack.ClientHttp; } else { httpStack = HttpStack.XmlHttp; } } if (httpStack == HttpStack.ClientHttp) { return new ClientHttpWebRequest(requestUri); } return new XHRHttpWebRequest(requestUri); }
/// <summary> /// Returns the request message to write the headers and payload into. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <param name="contentId">Content-ID header that could be used in batch request.</param> /// <returns>an instance of IODataRequestMessage.</returns> protected override ODataRequestMessageWrapper CreateRequestMessage(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor, string contentId) { BuildingRequestEventArgs args = this.RequestInfo.CreateRequestArgsAndFireBuildingRequest(method, requestUri, headers, this.RequestInfo.HttpStack, descriptor); return ODataRequestMessageWrapper.CreateBatchPartRequestMessage(this.batchWriter, args, this.RequestInfo, contentId); }
public DataServiceClientRequestMessageArgs(string method, Uri requestUri, bool usePostTunneling, bool useDefaultCredentials, IDictionary <string, string> headers, HttpStack httpStack) : this(method, requestUri, usePostTunneling, useDefaultCredentials, headers) { this.ClientHttpStack = httpStack; }
/// <summary> /// Asks the context to Fire the BuildingRequest event and get RequestMessageArgs. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <returns>A new RequestMessageArgs object for building the request message.</returns> internal BuildingRequestEventArgs CreateRequestArgsAndFireBuildingRequest(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor) { return(this.Context.CreateRequestArgsAndFireBuildingRequest(method, requestUri, headers, httpStack, descriptor)); }
/// <summary> /// Asks the context to Fire the BuildingRequest event and get RequestMessageArgs. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <returns>A new RequestMessageArgs object for building the request message.</returns> internal BuildingRequestEventArgs CreateRequestArgsAndFireBuildingRequest(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor) { return this.Context.CreateRequestArgsAndFireBuildingRequest(method, requestUri, headers, httpStack, descriptor); }
/// <summary> /// Returns the request message to write the headers and payload into. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <returns>an instance of IODataRequestMessage.</returns> protected ODataRequestMessageWrapper CreateTopLevelRequest(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor) { BuildingRequestEventArgs args = this.RequestInfo.CreateRequestArgsAndFireBuildingRequest(method, requestUri, headers, httpStack, descriptor); return this.RequestInfo.WriteHelper.CreateRequestMessage(args); }
/// <summary> /// Returns the request message to write the headers and payload into. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <param name="contentId">Content-ID header that could be used in batch request.</param> /// <returns>an instance of IODataRequestMessage.</returns> protected abstract ODataRequestMessageWrapper CreateRequestMessage(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor, string contentId);
/// <summary> /// Returns the request message to write the headers and payload into. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <param name="contentId">Content-ID header that could be used in batch request.</param> /// <returns>an instance of IODataRequestMessage.</returns> protected override ODataRequestMessageWrapper CreateRequestMessage(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor, string contentId) { return this.CreateTopLevelRequest(method, requestUri, headers, httpStack, descriptor); }
/// <summary> /// Returns the request message to write the headers and payload into. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <param name="contentId">Content-ID header that could be used in batch request.</param> /// <returns>an instance of IODataRequestMessage.</returns> protected override ODataRequestMessageWrapper CreateRequestMessage(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor, string contentId) { return(this.CreateTopLevelRequest(method, requestUri, headers, httpStack, descriptor)); }
/// <summary> /// Returns the request message to write the headers and payload into. /// </summary> /// <param name="method">Http method for the request.</param> /// <param name="requestUri">Base Uri for the request.</param> /// <param name="headers">Request headers.</param> /// <param name="httpStack">HttpStack to use.</param> /// <param name="descriptor">Descriptor for the request, if there is one.</param> /// <param name="contentId">Content-ID header that could be used in batch request.</param> /// <returns>an instance of IODataRequestMessage.</returns> protected override ODataRequestMessageWrapper CreateRequestMessage(string method, Uri requestUri, HeaderCollection headers, HttpStack httpStack, Descriptor descriptor, string contentId) { BuildingRequestEventArgs args = this.RequestInfo.CreateRequestArgsAndFireBuildingRequest(method, requestUri, headers, this.RequestInfo.HttpStack, descriptor); return(ODataRequestMessageWrapper.CreateBatchPartRequestMessage(this.batchWriter, args, this.RequestInfo, contentId)); }
/// <summary> /// Creates an instance of DataServiceTransportInfo. /// </summary> /// <param name="context">DataServiceContext instance.</param> /// <param name="httpStack">HttpStack to use for silverlight.</param> internal DataServiceTransportInfo(DataServiceContext context, HttpStack httpStack) { Debug.Assert(context != null, "context != null"); this.Context = context; this.HttpStack = httpStack; }