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
- ImageListUtils.cs
- ExpressionBuilder.cs
- PlanCompiler.cs
- SiteMapProvider.cs
- ObjectRef.cs
- BinaryFormatterSinks.cs
- WebPartDescription.cs
- MemberRelationshipService.cs
- GorillaCodec.cs
- CompilationUtil.cs
- GridViewCellAutomationPeer.cs
- Compiler.cs
- CollectionChangeEventArgs.cs
- ClaimSet.cs
- TemplateControlCodeDomTreeGenerator.cs
- SafeSecurityHandles.cs
- ValidatorUtils.cs
- DocComment.cs
- ListViewItemEventArgs.cs
- DateBoldEvent.cs
- _ServiceNameStore.cs
- ArgumentNullException.cs
- ResourceSet.cs
- ColumnResult.cs
- SettingsPropertyValueCollection.cs
- DeviceContext2.cs
- SctClaimDictionary.cs
- KeyFrames.cs
- CompModSwitches.cs
- TableDetailsCollection.cs
- IPEndPoint.cs
- ListBoxChrome.cs
- FixedTextPointer.cs
- DSASignatureFormatter.cs
- RemotingSurrogateSelector.cs
- LambdaReference.cs
- SystemException.cs
- SqlDeflator.cs
- CompareValidator.cs
- StatusBarItem.cs
- NTAccount.cs
- TableRowCollection.cs
- FrameworkElement.cs
- webproxy.cs
- DeferredTextReference.cs
- MetadataPropertyCollection.cs
- BasicExpandProvider.cs
- XPathNodePointer.cs
- MulticastOption.cs
- PermissionAttributes.cs
- BatchServiceHost.cs
- CodeTypeDeclarationCollection.cs
- MailDefinition.cs
- Model3D.cs
- MultipartIdentifier.cs
- Shared.cs
- _CommandStream.cs
- BamlTreeNode.cs
- ServiceBusyException.cs
- RemotingException.cs
- CanonicalFormWriter.cs
- ExceptionTrace.cs
- StickyNoteAnnotations.cs
- PreviewPrintController.cs
- CalendarDateRangeChangingEventArgs.cs
- FileReader.cs
- VSWCFServiceContractGenerator.cs
- UrlPath.cs
- ChannelServices.cs
- DuplicateWaitObjectException.cs
- ReadWriteObjectLock.cs
- Thread.cs
- EntityDesignPluralizationHandler.cs
- ListenerSessionConnectionReader.cs
- ThicknessConverter.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- Events.cs
- EnumerableRowCollection.cs
- PolyBezierSegmentFigureLogic.cs
- XmlDataDocument.cs
- HitTestWithGeometryDrawingContextWalker.cs
- Guid.cs
- KeyedHashAlgorithm.cs
- InputManager.cs
- PermissionRequestEvidence.cs
- TrackingServices.cs
- UniqueID.cs
- CodeBlockBuilder.cs
- BufferedReadStream.cs
- XmlSchemaException.cs
- RayMeshGeometry3DHitTestResult.cs
- SecurityHeaderElementInferenceEngine.cs
- SnapLine.cs
- CodeCommentStatementCollection.cs
- DbConnectionPool.cs
- MessagePropertyAttribute.cs
- HtmlTableRow.cs
- OwnerDrawPropertyBag.cs
- EditorAttribute.cs
- Bidi.cs