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
- LabelAutomationPeer.cs
- MetadataCache.cs
- ObjectDataSourceMethodEventArgs.cs
- WindowsGraphics.cs
- TraceHandlerErrorFormatter.cs
- HostingEnvironmentException.cs
- DayRenderEvent.cs
- TransactionOptions.cs
- InkSerializer.cs
- MethodSignatureGenerator.cs
- ExternalCalls.cs
- EntityObject.cs
- MetadataExchangeBindings.cs
- HttpBrowserCapabilitiesWrapper.cs
- HMACSHA1.cs
- SpecialNameAttribute.cs
- CompositeScriptReference.cs
- DataSourceCacheDurationConverter.cs
- Document.cs
- SqlDataRecord.cs
- SHA512.cs
- ValidatorCollection.cs
- ProcessModelInfo.cs
- SyndicationDeserializer.cs
- ListControl.cs
- SafeSecurityHandles.cs
- CommonProperties.cs
- ADMembershipProvider.cs
- QilSortKey.cs
- UshortList2.cs
- TraceSection.cs
- Variant.cs
- TypographyProperties.cs
- FlowDocumentPaginator.cs
- DecimalFormatter.cs
- ImageSourceValueSerializer.cs
- LiteralText.cs
- Trustee.cs
- Condition.cs
- DataKeyCollection.cs
- DependencyPropertyKind.cs
- SpecialNameAttribute.cs
- CommandLibraryHelper.cs
- DynamicPropertyHolder.cs
- RadioButtonList.cs
- PolicyException.cs
- IconHelper.cs
- XmlSchemaSimpleContentExtension.cs
- IsolatedStorageException.cs
- FixedSOMElement.cs
- Aggregates.cs
- CSharpCodeProvider.cs
- EmptyQuery.cs
- XmlSerializableServices.cs
- SizeKeyFrameCollection.cs
- ValidationPropertyAttribute.cs
- PropertyGrid.cs
- Style.cs
- XmlAttributeOverrides.cs
- GPStream.cs
- MsmqHostedTransportManager.cs
- SqlRetyper.cs
- IsolatedStorageFilePermission.cs
- WebPartTracker.cs
- EntityDataSourceSelectingEventArgs.cs
- ExceptionNotification.cs
- DataSourceExpressionCollection.cs
- WmlSelectionListAdapter.cs
- Signature.cs
- PolicyLevel.cs
- CapabilitiesSection.cs
- New.cs
- DataBindingsDialog.cs
- FixedPageProcessor.cs
- XsdCachingReader.cs
- ReaderOutput.cs
- Label.cs
- Command.cs
- StackOverflowException.cs
- FigureParaClient.cs
- ObjectStateManager.cs
- XmlAttributeProperties.cs
- TypeReference.cs
- PrincipalPermission.cs
- ValueExpressions.cs
- ListSortDescriptionCollection.cs
- PeerContact.cs
- TileBrush.cs
- AnonymousIdentificationModule.cs
- SizeConverter.cs
- SaveFileDialog.cs
- Misc.cs
- QilSortKey.cs
- ObjectConverter.cs
- SendMailErrorEventArgs.cs
- InvalidProgramException.cs
- Expander.cs
- ManagedWndProcTracker.cs
- HelpFileFileNameEditor.cs
- NameValuePair.cs