Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / Script / Services / RestHandlerFactory.cs / 1 / 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
- RayMeshGeometry3DHitTestResult.cs
- DocumentPageHost.cs
- AsyncStreamReader.cs
- LocalizedNameDescriptionPair.cs
- MetabaseSettingsIis7.cs
- HostUtils.cs
- PageFunction.cs
- SByte.cs
- SqlRowUpdatingEvent.cs
- TextServicesCompartmentEventSink.cs
- PersonalizationState.cs
- ListView.cs
- AlignmentXValidation.cs
- FontStyle.cs
- Permission.cs
- CultureInfo.cs
- EventInfo.cs
- HttpBindingExtension.cs
- RuntimeEnvironment.cs
- WebBrowserUriTypeConverter.cs
- CodeDefaultValueExpression.cs
- SymbolType.cs
- RSACryptoServiceProvider.cs
- BitmapCache.cs
- peersecurityelement.cs
- ProviderConnectionPoint.cs
- SQLInt16Storage.cs
- CellParaClient.cs
- SqlProviderManifest.cs
- StylusButtonCollection.cs
- _AutoWebProxyScriptWrapper.cs
- WebEventTraceProvider.cs
- XmlDataCollection.cs
- FunctionImportElement.cs
- XdrBuilder.cs
- XmlSchemaAnyAttribute.cs
- ComplexTypeEmitter.cs
- MergePropertyDescriptor.cs
- Point3DCollection.cs
- PersonalizationStateQuery.cs
- SecurityException.cs
- AutomationElementCollection.cs
- FixedSOMElement.cs
- FixedSOMPage.cs
- EnumConverter.cs
- CodeSnippetExpression.cs
- HtmlFormParameterWriter.cs
- SystemColorTracker.cs
- CodeTypeReferenceCollection.cs
- CodeIdentifier.cs
- DateTimePicker.cs
- HttpProfileGroupBase.cs
- x509utils.cs
- RootBuilder.cs
- Task.cs
- Triangle.cs
- EditingCoordinator.cs
- NameSpaceEvent.cs
- ConfigsHelper.cs
- CharacterMetricsDictionary.cs
- LineGeometry.cs
- PackageProperties.cs
- MimePart.cs
- RemotingAttributes.cs
- CollectionType.cs
- AnchoredBlock.cs
- TypeKeyValue.cs
- OleDbSchemaGuid.cs
- SqlPersonalizationProvider.cs
- FocusWithinProperty.cs
- ToolStripItemClickedEventArgs.cs
- SettingsBase.cs
- TaskForm.cs
- CodeAssignStatement.cs
- SqlClientFactory.cs
- SHA512CryptoServiceProvider.cs
- PeerServiceMessageContracts.cs
- EndpointAddressElementBase.cs
- MetadataCache.cs
- MetafileHeaderWmf.cs
- SrgsSemanticInterpretationTag.cs
- SortExpressionBuilder.cs
- DataSourceXmlTextReader.cs
- ObjectKeyFrameCollection.cs
- Application.cs
- TreeViewCancelEvent.cs
- BitmapEffectGroup.cs
- HttpCachePolicy.cs
- AcceleratedTokenProvider.cs
- Table.cs
- Bitmap.cs
- CellCreator.cs
- WmpBitmapEncoder.cs
- EditBehavior.cs
- HttpException.cs
- OleDbPermission.cs
- ApplicationContext.cs
- ProfessionalColorTable.cs
- CalculatedColumn.cs
- BufferedGraphicsManager.cs