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
- DoubleAnimationUsingPath.cs
- ProcessExitedException.cs
- InProcStateClientManager.cs
- BuildProvider.cs
- TextEndOfLine.cs
- PreviewPrintController.cs
- XPathParser.cs
- TextBox.cs
- MaskInputRejectedEventArgs.cs
- RequestQueryProcessor.cs
- AspNetCacheProfileAttribute.cs
- XmlLoader.cs
- VisualStyleInformation.cs
- MeshGeometry3D.cs
- SendMailErrorEventArgs.cs
- AsyncOperationManager.cs
- IItemProperties.cs
- RtfToken.cs
- SortedList.cs
- FloaterParaClient.cs
- QuadraticBezierSegment.cs
- RequestQueryProcessor.cs
- Variant.cs
- xamlnodes.cs
- CLSCompliantAttribute.cs
- ViewKeyConstraint.cs
- PointLightBase.cs
- ConsoleCancelEventArgs.cs
- ExclusiveHandleList.cs
- TraceHandler.cs
- OptimalTextSource.cs
- DocumentPageTextView.cs
- UnsettableComboBox.cs
- smtpconnection.cs
- CodeBlockBuilder.cs
- DataConnectionHelper.cs
- FixedBufferAttribute.cs
- ProcessInputEventArgs.cs
- FixedSOMTextRun.cs
- Mapping.cs
- SelectionEditor.cs
- ImageSource.cs
- RenderOptions.cs
- PositiveTimeSpanValidator.cs
- LineInfo.cs
- HttpRequestCacheValidator.cs
- DataListCommandEventArgs.cs
- PointCollectionValueSerializer.cs
- SBCSCodePageEncoding.cs
- HotCommands.cs
- AsynchronousChannel.cs
- RichTextBox.cs
- ContextStack.cs
- PropertyNames.cs
- ECDiffieHellmanPublicKey.cs
- ControlTemplate.cs
- HandleRef.cs
- WebBrowserPermission.cs
- SchemaSetCompiler.cs
- CapabilitiesAssignment.cs
- CompilationPass2Task.cs
- TextSelectionProcessor.cs
- SplitContainerDesigner.cs
- BamlBinaryWriter.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- WS2007HttpBindingElement.cs
- FileChangesMonitor.cs
- UshortList2.cs
- EntryPointNotFoundException.cs
- Wrapper.cs
- AppDomainInfo.cs
- DetailsViewPagerRow.cs
- BindUriHelper.cs
- BitStack.cs
- GrammarBuilder.cs
- HashStream.cs
- XmlNodeChangedEventArgs.cs
- DataGridAutomationPeer.cs
- ByteConverter.cs
- PropertyDescriptorComparer.cs
- HuffCodec.cs
- ProcessMonitor.cs
- SQLBytes.cs
- DataObjectEventArgs.cs
- QilPatternFactory.cs
- CannotUnloadAppDomainException.cs
- AuthenticationModuleElement.cs
- XPathCompileException.cs
- MetadataPropertyCollection.cs
- SqlXml.cs
- VoiceObjectToken.cs
- AngleUtil.cs
- ConditionalDesigner.cs
- CorrelationTokenInvalidatedHandler.cs
- DataSourceHelper.cs
- XmlIlVisitor.cs
- AnyReturnReader.cs
- CachedPathData.cs
- IfAction.cs
- OleDbParameterCollection.cs