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
- ConnectionOrientedTransportManager.cs
- PageAdapter.cs
- Enlistment.cs
- TextProperties.cs
- SmtpClient.cs
- PageThemeParser.cs
- ButtonBaseAutomationPeer.cs
- InputMethodStateTypeInfo.cs
- LookupNode.cs
- propertytag.cs
- TableLayoutStyle.cs
- NavigationProgressEventArgs.cs
- QuadraticBezierSegment.cs
- BinaryFormatterWriter.cs
- ExcludePathInfo.cs
- DataGridBoundColumn.cs
- PatternMatcher.cs
- IncomingWebRequestContext.cs
- DataSourceCollectionBase.cs
- IxmlLineInfo.cs
- DataSourceProvider.cs
- SharedConnectionListener.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- SetterBaseCollection.cs
- DataRelationPropertyDescriptor.cs
- UniqueIdentifierService.cs
- DesignerDataView.cs
- ConstantSlot.cs
- ScriptControlDescriptor.cs
- SecurityException.cs
- TextRangeEditLists.cs
- SymLanguageType.cs
- ObjectDesignerDataSourceView.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- HorizontalAlignConverter.cs
- PointCollection.cs
- BadImageFormatException.cs
- EntityParameter.cs
- InheritanceContextChangedEventManager.cs
- SystemIPInterfaceStatistics.cs
- PointCollectionValueSerializer.cs
- ObjectIDGenerator.cs
- InputScopeAttribute.cs
- SystemIPInterfaceProperties.cs
- ProcessHostMapPath.cs
- RegexReplacement.cs
- WinFormsSecurity.cs
- Environment.cs
- ListCollectionView.cs
- TextTreeText.cs
- HttpHeaderCollection.cs
- UnsafeNativeMethods.cs
- WebPartCloseVerb.cs
- DataGridPagerStyle.cs
- SQLBinaryStorage.cs
- WizardStepBase.cs
- LocalizedNameDescriptionPair.cs
- ImageMapEventArgs.cs
- StorageEndPropertyMapping.cs
- NameValueConfigurationElement.cs
- ValidationSummary.cs
- ApplicationProxyInternal.cs
- SiteIdentityPermission.cs
- QueryStringParameter.cs
- DoubleConverter.cs
- HtmlControlAdapter.cs
- Dump.cs
- cookiecollection.cs
- PrivateFontCollection.cs
- ClientSettingsProvider.cs
- InstalledVoice.cs
- AlternateViewCollection.cs
- ObjectListFieldCollection.cs
- ISAPIRuntime.cs
- COM2TypeInfoProcessor.cs
- SQLStringStorage.cs
- SelectedDatesCollection.cs
- CleanUpVirtualizedItemEventArgs.cs
- HttpRawResponse.cs
- ValidationResult.cs
- WindowsSpinner.cs
- EncryptedPackageFilter.cs
- WorkflowOperationFault.cs
- PersonalizationProviderHelper.cs
- BitmapEffectInputConnector.cs
- ImageListStreamer.cs
- StrongNamePublicKeyBlob.cs
- ViewBase.cs
- EventProviderBase.cs
- ProxyWebPartManager.cs
- BrowserCapabilitiesCodeGenerator.cs
- ExpressionBuilderCollection.cs
- XmlDataSourceNodeDescriptor.cs
- SqlProfileProvider.cs
- TimeSpanMinutesConverter.cs
- StorageComplexTypeMapping.cs
- TextEffectCollection.cs
- ObjectConverter.cs
- FamilyTypefaceCollection.cs
- DayRenderEvent.cs