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
- ClassData.cs
- PassportIdentity.cs
- BinaryNode.cs
- IndentedWriter.cs
- HttpRequest.cs
- Italic.cs
- SecurityPermission.cs
- JsonWriter.cs
- ConditionedDesigner.cs
- updateconfighost.cs
- DNS.cs
- TemplatedMailWebEventProvider.cs
- IndentTextWriter.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- Cursor.cs
- SetIterators.cs
- TypeInitializationException.cs
- DataGridViewSortCompareEventArgs.cs
- PrefixQName.cs
- ErrorsHelper.cs
- IssuedTokenServiceCredential.cs
- MultipartContentParser.cs
- ADMembershipUser.cs
- ListViewInsertionMark.cs
- MethodInfo.cs
- SeparatorAutomationPeer.cs
- x509utils.cs
- FormsAuthenticationModule.cs
- XmlTextEncoder.cs
- XmlAttributeProperties.cs
- ListViewInsertionMark.cs
- NamespaceList.cs
- StoreAnnotationsMap.cs
- _FtpControlStream.cs
- PropertyState.cs
- ScriptReference.cs
- SelectionChangedEventArgs.cs
- AnnotationDocumentPaginator.cs
- XPathException.cs
- XmlAnyElementAttribute.cs
- CleanUpVirtualizedItemEventArgs.cs
- VectorCollectionValueSerializer.cs
- DynamicQueryableWrapper.cs
- WebEvents.cs
- SliderAutomationPeer.cs
- HttpRequest.cs
- QilGeneratorEnv.cs
- WebBrowserNavigatedEventHandler.cs
- NamespaceInfo.cs
- ToolStripItem.cs
- CodeMemberEvent.cs
- FormViewUpdatedEventArgs.cs
- ListViewPagedDataSource.cs
- MinMaxParagraphWidth.cs
- SrgsOneOf.cs
- RegexCharClass.cs
- _DigestClient.cs
- BitmapCodecInfoInternal.cs
- Int16AnimationBase.cs
- EntitySetDataBindingList.cs
- ItemCollection.cs
- Int64KeyFrameCollection.cs
- SqlDataSourceQueryEditorForm.cs
- ResetableIterator.cs
- CapabilitiesAssignment.cs
- OverflowException.cs
- XmlSchemaSet.cs
- ScaleTransform.cs
- DataGridColumnDropSeparator.cs
- InternalConfigSettingsFactory.cs
- XmlFileEditor.cs
- ObjectHelper.cs
- GPPOINTF.cs
- XmlTextReaderImpl.cs
- SupportingTokenBindingElement.cs
- ButtonFlatAdapter.cs
- AutoSizeToolBoxItem.cs
- WebScriptServiceHostFactory.cs
- WorkflowStateRollbackService.cs
- BaseDataListComponentEditor.cs
- Label.cs
- DependencyObjectPropertyDescriptor.cs
- WorkflowMarkupSerializationException.cs
- TextBoxAutoCompleteSourceConverter.cs
- SmtpDigestAuthenticationModule.cs
- FlowLayoutSettings.cs
- WorkflowApplicationEventArgs.cs
- PopOutPanel.cs
- CqlParser.cs
- GlobalizationSection.cs
- StrokeCollectionConverter.cs
- ControlBuilder.cs
- ToolboxComponentsCreatingEventArgs.cs
- StaticFileHandler.cs
- DiscoveryDocumentReference.cs
- AtlasWeb.Designer.cs
- OutputWindow.cs
- NetworkStream.cs
- ControlParameter.cs
- CopyAttributesAction.cs