Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- InstanceLockLostException.cs
- DataGridRowHeaderAutomationPeer.cs
- QuestionEventArgs.cs
- PrtCap_Builder.cs
- ActivationArguments.cs
- Inline.cs
- AxisAngleRotation3D.cs
- ToolStripComboBox.cs
- AttachedAnnotation.cs
- Rect3D.cs
- DataTableMapping.cs
- Missing.cs
- SqlUdtInfo.cs
- RIPEMD160Managed.cs
- MemoryFailPoint.cs
- SystemResourceKey.cs
- ThreadSafeMessageFilterTable.cs
- PowerStatus.cs
- PermissionListSet.cs
- Menu.cs
- FixedPosition.cs
- XamlTreeBuilderBamlRecordWriter.cs
- StylusDownEventArgs.cs
- Brush.cs
- UpdatePanelControlTrigger.cs
- ApplicationSecurityManager.cs
- ToolStripDropDown.cs
- FileAccessException.cs
- MLangCodePageEncoding.cs
- DocumentNUp.cs
- GridViewSelectEventArgs.cs
- Transform.cs
- SimpleTextLine.cs
- DataSysAttribute.cs
- FlowLayoutPanel.cs
- CatalogZoneAutoFormat.cs
- GenericArgumentsUpdater.cs
- PolicyLevel.cs
- DataTemplateKey.cs
- WebControlParameterProxy.cs
- WebPartTracker.cs
- ModifierKeysValueSerializer.cs
- UnmanagedMemoryAccessor.cs
- SiteMembershipCondition.cs
- SerializationStore.cs
- HttpException.cs
- TextEffectCollection.cs
- StringAnimationBase.cs
- Image.cs
- System.Data_BID.cs
- COAUTHIDENTITY.cs
- LineBreakRecord.cs
- Figure.cs
- ReadOnlyDictionary.cs
- ViewBox.cs
- AttachedAnnotationChangedEventArgs.cs
- MatrixKeyFrameCollection.cs
- DeadCharTextComposition.cs
- ExecutionContext.cs
- FileLevelControlBuilderAttribute.cs
- TextBox.cs
- TransformValueSerializer.cs
- LineProperties.cs
- InputScopeConverter.cs
- MarkerProperties.cs
- TimeManager.cs
- CodeLabeledStatement.cs
- InkCollectionBehavior.cs
- SQLInt16.cs
- ZipIOCentralDirectoryBlock.cs
- DynamicQueryableWrapper.cs
- QuinticEase.cs
- CommonObjectSecurity.cs
- EntityContainerEntitySet.cs
- DataServiceExpressionVisitor.cs
- IssuedTokenServiceCredential.cs
- TableItemStyle.cs
- TransformDescriptor.cs
- DelegatingTypeDescriptionProvider.cs
- NameService.cs
- XmlSortKey.cs
- TableRow.cs
- XsltException.cs
- ApplicationActivator.cs
- PropertyPushdownHelper.cs
- MasterPageBuildProvider.cs
- LowerCaseStringConverter.cs
- AnonymousIdentificationModule.cs
- EditorAttribute.cs
- DbParameterCollectionHelper.cs
- CrossAppDomainChannel.cs
- ClickablePoint.cs
- WebPartDisplayModeEventArgs.cs
- ClientSideQueueItem.cs
- SecurityContext.cs
- StylusPointPropertyUnit.cs
- PointValueSerializer.cs
- SqlNodeTypeOperators.cs
- ObjectCloneHelper.cs
- COM2PictureConverter.cs