Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Script / Services / RestHandlerFactory.cs / 1305376 / RestHandlerFactory.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Services { internal class RestHandlerFactory : IHttpHandlerFactory { internal const string ClientProxyRequestPathInfo = "/js"; internal const string ClientDebugProxyRequestPathInfo = "/jsdebug"; public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { if (context == null) { throw new ArgumentNullException("context"); } if (IsClientProxyRequest(context.Request.PathInfo)) { // It's a request for client side proxies return new RestClientProxyHandler(); } else { // The request is an actual call to a server method return RestHandler.CreateHandler(context); } } public virtual void ReleaseHandler(IHttpHandler handler) { } // Detects if this is a request we want to intercept, i.e. invocation or proxy request internal static bool IsRestRequest(HttpContext context) { return IsRestMethodCall(context.Request) || IsClientProxyRequest(context.Request.PathInfo); } // Detects if this is a method invocation, i.e. webservice call or page method call internal static bool IsRestMethodCall(HttpRequest request) { return !String.IsNullOrEmpty(request.PathInfo) && (request.ContentType.StartsWith("application/json;", StringComparison.OrdinalIgnoreCase) || string.Equals(request.ContentType, "application/json", StringComparison.OrdinalIgnoreCase)); } internal static bool IsClientProxyDebugRequest(string pathInfo) { return string.Equals(pathInfo, ClientDebugProxyRequestPathInfo, StringComparison.OrdinalIgnoreCase); } internal static bool IsClientProxyRequest(string pathInfo) { return (string.Equals(pathInfo, ClientProxyRequestPathInfo, StringComparison.OrdinalIgnoreCase) || IsClientProxyDebugRequest(pathInfo)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Services { internal class RestHandlerFactory : IHttpHandlerFactory { internal const string ClientProxyRequestPathInfo = "/js"; internal const string ClientDebugProxyRequestPathInfo = "/jsdebug"; public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { if (context == null) { throw new ArgumentNullException("context"); } if (IsClientProxyRequest(context.Request.PathInfo)) { // It's a request for client side proxies return new RestClientProxyHandler(); } else { // The request is an actual call to a server method return RestHandler.CreateHandler(context); } } public virtual void ReleaseHandler(IHttpHandler handler) { } // Detects if this is a request we want to intercept, i.e. invocation or proxy request internal static bool IsRestRequest(HttpContext context) { return IsRestMethodCall(context.Request) || IsClientProxyRequest(context.Request.PathInfo); } // Detects if this is a method invocation, i.e. webservice call or page method call internal static bool IsRestMethodCall(HttpRequest request) { return !String.IsNullOrEmpty(request.PathInfo) && (request.ContentType.StartsWith("application/json;", StringComparison.OrdinalIgnoreCase) || string.Equals(request.ContentType, "application/json", StringComparison.OrdinalIgnoreCase)); } internal static bool IsClientProxyDebugRequest(string pathInfo) { return string.Equals(pathInfo, ClientDebugProxyRequestPathInfo, StringComparison.OrdinalIgnoreCase); } internal static bool IsClientProxyRequest(string pathInfo) { return (string.Equals(pathInfo, ClientProxyRequestPathInfo, StringComparison.OrdinalIgnoreCase) || IsClientProxyDebugRequest(pathInfo)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DocumentViewerBaseAutomationPeer.cs
- ConnectionInterfaceCollection.cs
- CodeSubDirectoriesCollection.cs
- SortKey.cs
- BasicHttpMessageSecurity.cs
- SettingsProperty.cs
- UIPropertyMetadata.cs
- RangeContentEnumerator.cs
- Transform3D.cs
- WebExceptionStatus.cs
- NotifyCollectionChangedEventArgs.cs
- RawStylusInputCustomDataList.cs
- EventMappingSettings.cs
- MachineSettingsSection.cs
- TemplateBaseAction.cs
- _NativeSSPI.cs
- NextPreviousPagerField.cs
- UserControlDocumentDesigner.cs
- FileUtil.cs
- MultilineStringEditor.cs
- PropertyGridEditorPart.cs
- PolicyConversionContext.cs
- ListBox.cs
- SecurityUtils.cs
- WebDisplayNameAttribute.cs
- PartialCachingAttribute.cs
- CFGGrammar.cs
- Renderer.cs
- ProfileProvider.cs
- Brushes.cs
- RepeaterDataBoundAdapter.cs
- PassportPrincipal.cs
- XmlQueryCardinality.cs
- XmlQuerySequence.cs
- CollectionsUtil.cs
- AgileSafeNativeMemoryHandle.cs
- ScrollBarRenderer.cs
- ComPlusThreadInitializer.cs
- FormsAuthenticationUser.cs
- ComboBoxRenderer.cs
- versioninfo.cs
- ListView.cs
- _CookieModule.cs
- AudioFormatConverter.cs
- connectionpool.cs
- QueryAccessibilityHelpEvent.cs
- WebConfigManager.cs
- TextViewSelectionProcessor.cs
- SortQueryOperator.cs
- SystemColorTracker.cs
- MimeMapping.cs
- Propagator.ExtentPlaceholderCreator.cs
- DES.cs
- TemplateControlCodeDomTreeGenerator.cs
- DataRelation.cs
- DispatcherEventArgs.cs
- MonitorWrapper.cs
- XslAstAnalyzer.cs
- ApplicationId.cs
- WmpBitmapDecoder.cs
- ExternalCalls.cs
- LicenseManager.cs
- NetDataContractSerializer.cs
- ScriptModule.cs
- Exceptions.cs
- FilterableAttribute.cs
- ProbeMatches11.cs
- BigInt.cs
- ControlParameter.cs
- TargetControlTypeAttribute.cs
- HtmlInputCheckBox.cs
- NumericUpDownAcceleration.cs
- Trace.cs
- SemaphoreSlim.cs
- CreateUserErrorEventArgs.cs
- RegexGroup.cs
- OverflowException.cs
- MultipleViewProviderWrapper.cs
- RegexStringValidatorAttribute.cs
- SqlVersion.cs
- ProgressBar.cs
- KeyMatchBuilder.cs
- WebInvokeAttribute.cs
- WindowsEditBox.cs
- GeometryHitTestResult.cs
- HtmlLink.cs
- XmlNamespaceManager.cs
- ToolstripProfessionalRenderer.cs
- TransformProviderWrapper.cs
- QilChoice.cs
- Rijndael.cs
- ControlAdapter.cs
- DbProviderFactories.cs
- UiaCoreProviderApi.cs
- FilePrompt.cs
- FrameworkElement.cs
- OrderedEnumerableRowCollection.cs
- CatalogPart.cs
- WebPartZone.cs
- CqlParser.cs