Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ResourcePool.cs
- Msec.cs
- CommittableTransaction.cs
- PolicyException.cs
- BufferedStream.cs
- ValidatingPropertiesEventArgs.cs
- Queue.cs
- SimpleMailWebEventProvider.cs
- TypeConverter.cs
- InvalidOperationException.cs
- SizeChangedEventArgs.cs
- PackWebRequestFactory.cs
- BamlVersionHeader.cs
- AccessDataSourceWizardForm.cs
- GatewayIPAddressInformationCollection.cs
- GenerateTemporaryTargetAssembly.cs
- MonitorWrapper.cs
- _AuthenticationState.cs
- BoundColumn.cs
- UIElement.cs
- BulletedListDesigner.cs
- Constraint.cs
- BulletChrome.cs
- DbQueryCommandTree.cs
- ErrorTolerantObjectWriter.cs
- WebScriptMetadataMessageEncoderFactory.cs
- StringFreezingAttribute.cs
- HybridDictionary.cs
- selecteditemcollection.cs
- Token.cs
- RecognizedWordUnit.cs
- HtmlGenericControl.cs
- serverconfig.cs
- Membership.cs
- HierarchicalDataTemplate.cs
- InvokeProviderWrapper.cs
- AbstractExpressions.cs
- DSGeneratorProblem.cs
- MimeTypeMapper.cs
- GeometryModel3D.cs
- COSERVERINFO.cs
- DistinctQueryOperator.cs
- GenericsInstances.cs
- XamlTreeBuilderBamlRecordWriter.cs
- MessageQueuePermissionEntry.cs
- SmiEventSink_Default.cs
- SqlBulkCopy.cs
- KeySplineConverter.cs
- Attachment.cs
- DbParameterHelper.cs
- DataColumn.cs
- ToolStripItemImageRenderEventArgs.cs
- AlgoModule.cs
- HelpOperationInvoker.cs
- DesignSurface.cs
- RegisteredScript.cs
- OrderedDictionary.cs
- EndpointConfigContainer.cs
- NavigationWindowAutomationPeer.cs
- WindowCollection.cs
- TypedReference.cs
- SecurityDocument.cs
- HtmlTableCellCollection.cs
- ServiceAuthorizationElement.cs
- ServerIdentity.cs
- ISessionStateStore.cs
- TimeoutValidationAttribute.cs
- DataRelationPropertyDescriptor.cs
- HttpCookieCollection.cs
- UIntPtr.cs
- OutputCacheSection.cs
- Utils.cs
- SmtpCommands.cs
- CngAlgorithmGroup.cs
- SmtpLoginAuthenticationModule.cs
- DesignerVerb.cs
- EventHandlerList.cs
- DataGrid.cs
- PropertiesTab.cs
- DataTableExtensions.cs
- WebHeaderCollection.cs
- NullEntityWrapper.cs
- WindowsFont.cs
- CssTextWriter.cs
- WebBaseEventKeyComparer.cs
- FixedSOMTextRun.cs
- CodeEventReferenceExpression.cs
- BitmapEffectGeneralTransform.cs
- COAUTHINFO.cs
- FormatSettings.cs
- LeafCellTreeNode.cs
- CharKeyFrameCollection.cs
- CmsInterop.cs
- NodeLabelEditEvent.cs
- WebPartManager.cs
- ProtocolReflector.cs
- DateTimeValueSerializer.cs
- TTSVoice.cs
- precedingsibling.cs
- RegexCompiler.cs