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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LinkConverter.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- ManagementEventArgs.cs
- AsyncResult.cs
- SimpleWebHandlerParser.cs
- DbConnectionPool.cs
- WindowsFormsSynchronizationContext.cs
- TextDataBindingHandler.cs
- WCFServiceClientProxyGenerator.cs
- SqlCaseSimplifier.cs
- StretchValidation.cs
- QilName.cs
- GatewayDefinition.cs
- ToolStripDesigner.cs
- XmlSchemaValidator.cs
- SocketManager.cs
- DataControlPagerLinkButton.cs
- ListBindingHelper.cs
- WsdlHelpGeneratorElement.cs
- IDispatchConstantAttribute.cs
- ListenerElementsCollection.cs
- TemplateBindingExpression.cs
- bidPrivateBase.cs
- PassportAuthenticationModule.cs
- dtdvalidator.cs
- EventHandlersStore.cs
- OleDbMetaDataFactory.cs
- CommonProperties.cs
- RoleGroupCollection.cs
- Decimal.cs
- ActivityDelegate.cs
- SqlXmlStorage.cs
- HttpChannelHelper.cs
- SafeCryptoHandles.cs
- HMACRIPEMD160.cs
- XmlSchemaObject.cs
- WebBrowserHelper.cs
- NetSectionGroup.cs
- ItemsControl.cs
- ChangesetResponse.cs
- SoapReflectionImporter.cs
- MetadataItemCollectionFactory.cs
- PerfService.cs
- AuditLog.cs
- CommandBindingCollection.cs
- QueueProcessor.cs
- StringConverter.cs
- TdsValueSetter.cs
- TabletCollection.cs
- StorageInfo.cs
- ScrollChrome.cs
- SessionPageStateSection.cs
- DBCommandBuilder.cs
- FixedSOMFixedBlock.cs
- InstanceDataCollectionCollection.cs
- BrushMappingModeValidation.cs
- ValidatingReaderNodeData.cs
- NativeMethodsCLR.cs
- SqlWriter.cs
- RequestCachePolicy.cs
- Pen.cs
- IncrementalCompileAnalyzer.cs
- CompatibleIComparer.cs
- TableItemStyle.cs
- ToolStripPanelCell.cs
- DataSourceDesigner.cs
- BroadcastEventHelper.cs
- DoubleStorage.cs
- FlowDocumentReader.cs
- JsonReaderDelegator.cs
- EntitySqlQueryCacheEntry.cs
- BitmapEffectDrawingContextState.cs
- ToolStripMenuItem.cs
- PropertySegmentSerializer.cs
- EventLogLink.cs
- MemoryMappedView.cs
- Pair.cs
- DesignerTransaction.cs
- TextBoxBase.cs
- PowerEase.cs
- EventDescriptor.cs
- UserPersonalizationStateInfo.cs
- DetailsViewUpdateEventArgs.cs
- StretchValidation.cs
- InfoCardRSACryptoProvider.cs
- RegexTree.cs
- Util.cs
- KoreanLunisolarCalendar.cs
- VerificationException.cs
- SoapCodeExporter.cs
- MultiSelectRootGridEntry.cs
- SystemIPAddressInformation.cs
- HttpDateParse.cs
- CalloutQueueItem.cs
- AnnotationComponentChooser.cs
- EntityDataSourceReferenceGroup.cs
- TextEditorTables.cs
- FontFamily.cs
- SecurityDocument.cs
- SelectorItemAutomationPeer.cs