Files
acceptance-tests
data
docs
external
ikvm-native
libgc
llvm
m4
man
mcs
build
class
Accessibility
Commons.Xml.Relaxng
Cscompmgd
CustomMarshalers
Facades
I18N
IBM.Data.DB2
ICSharpCode.SharpZipLib
Microsoft.Build
Microsoft.Build.Engine
Microsoft.Build.Framework
Microsoft.Build.Tasks
Microsoft.Build.Utilities
Microsoft.CSharp
Microsoft.NuGet.Build.Tasks
Microsoft.VisualC
Microsoft.Web.Infrastructure
MicrosoftAjaxLibrary
Mono.Btls.Interface
Mono.C5
Mono.CSharp
Mono.Cairo
Mono.Cecil
Mono.Cecil.Mdb
Mono.CodeContracts
Mono.CompilerServices.SymbolWriter
Mono.Data.Sqlite
Mono.Data.Tds
Mono.Debugger.Soft
Mono.Http
Mono.Management
Mono.Messaging
Mono.Messaging.RabbitMQ
Mono.Options
Mono.Parallel
Mono.Posix
Mono.Profiler.Log
Mono.Runtime.Tests
Mono.Security
Mono.Security.Win32
Mono.Simd
Mono.Tasklets
Mono.WebBrowser
Mono.XBuild.Tasks
Novell.Directory.Ldap
PEAPI
RabbitMQ.Client
SMDiagnostics
System
System.ComponentModel.Composition.4.5
System.ComponentModel.DataAnnotations
System.Configuration
System.Configuration.Install
System.Core
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Linq
System.Data.OracleClient
System.Data.Services
System.Data.Services.Client
System.Deployment
System.Design
System.DirectoryServices
System.DirectoryServices.Protocols
System.Drawing
System.Drawing.Design
System.Dynamic
System.EnterpriseServices
System.IO.Compression
System.IO.Compression.FileSystem
System.IdentityModel
System.IdentityModel.Selectors
System.Json
System.Json.Microsoft
System.Management
System.Messaging
System.Net
System.Net.Http
System.Net.Http.Formatting
System.Net.Http.WebRequest
System.Net.Http.WinHttpHandler
System.Numerics
System.Numerics.Vectors
System.Reactive.Core
System.Reactive.Debugger
System.Reactive.Experimental
System.Reactive.Interfaces
System.Reactive.Linq
System.Reactive.Observable.Aliases
System.Reactive.PlatformServices
System.Reactive.Providers
System.Reactive.Runtime.Remoting
System.Reactive.Windows.Forms
System.Reactive.Windows.Threading
System.Reflection.Context
System.Runtime.Caching
System.Runtime.CompilerServices.Unsafe
System.Runtime.DurableInstancing
System.Runtime.Remoting
System.Runtime.Serialization
System.Runtime.Serialization.Formatters.Soap
System.Security
System.ServiceModel
Assembly
Documentation
Mono.CodeGeneration
Mono.Security.Protocol.Ntlm
Mono.Xml.XPath
ReferenceSources
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Channels
System.ServiceModel.Channels.Http
System.ServiceModel.Channels.NetTcp
System.ServiceModel.Channels.Security
System.ServiceModel.ComIntegration
System.ServiceModel.Configuration
System.ServiceModel.Description
System.ServiceModel.Diagnostics
System.ServiceModel.Dispatcher
ActionMessageFilter.cs
ActionMessageFilterTable.cs
BaseMessagesFormatter.cs
BaseRequestProcessor.cs
BaseRequestProcessorHandler.cs
CallbackInstanceContextProvider.cs
ChannelDispatcher.cs
ChannelDispatcherBase.cs
ChannelDispatcherCollection.cs
ClientOperation.cs
ClientRuntime.cs
DataContractSerializerServiceBehavior.cs
DefaultInstanceContextProvider.cs
DefaultOperationInvoker.cs
DispatchOperation.cs
DispatchRuntime.cs
EndpointAddressMessageFilter.cs
EndpointAddressMessageFilterTable.cs
EndpointDispatcher.cs
ErrorProcessingHandler.cs
ExceptionHandler.cs
FaultContractInfo.cs
FilterInvalidBodyAccessException.cs
FinalizeProcessingHandler.cs
ICallContextInitializer.cs
IChannelDispatcherBoundListener.cs
IChannelInitializer.cs
IClientMessageFormatter.cs
IClientMessageInspector.cs
IClientOperationSelector.cs
IDispatchMessageFormatter.cs
IDispatchMessageInspector.cs
IDispatchOperationSelector.cs
IErrorHandler.cs
IInputSessionShutdown.cs
IInstanceContextInitializer.cs
IInstanceContextProvider.cs
IInstanceProvider.cs
IInteractiveChannelInitializer.cs
IMessageFilterTable.cs
IOperationInvoker.cs
IParameterInspector.cs
InitializingHandler.cs
InputOrReplyRequestProcessor.cs
InstanceContextIdleCallback.cs
InstanceManager.cs
InvalidBodyAccessException.cs
MatchAllMessageFilter.cs
MatchNoneMessageFilter.cs
MessageFilter.cs
MessageFilterNodeQuotaExceededException.cs
MessageFilterTable.cs
MessageProcessingContext.cs
MexInstanceContextProvider.cs
MultipleMessageFilterMatchesException.cs
NavigatorInvalidBodyAccessException.cs
OperationInvokerHandler.cs
PostReceiveRequestHandler.cs
PrefixEndpointAddressMessageFilter.cs
ReplyHandler.cs
SeekableXPathNavigator.cs
ServiceThrottle.cs
SessionInstanceContextProvider.cs
SingletonInstanceContextProvider.cs
XPathMessageContext.cs
XPathMessageFilter.cs
XPathMessageFilterTable.cs
XPathNavigatorException.cs
XmlMessagesFormatter.cs
System.ServiceModel.MsmqIntegration
System.ServiceModel.PeerResolvers
System.ServiceModel.Security
System.ServiceModel.Security.Tokens
Test
corefx
resources
Dummy_2_1.cs
Dummy_XM_4_5.cs
Makefile
System.ServiceModel.dll.sources
System.ServiceModel_test.dll.sources
mobile_System.ServiceModel.dll.sources
monodroid_System.ServiceModel.dll.sources
monodroid_System.ServiceModel_test.dll.exclude.sources
monotouch_System.ServiceModel.dll.sources
monotouch_tv_System.ServiceModel.dll.sources
monotouch_watch_System.ServiceModel.dll.sources
orbis_System.ServiceModel.dll.sources
testing_aot_full_System.ServiceModel.dll.sources
testing_aot_full_System.ServiceModel_test.dll.exclude.sources
testing_aot_full_System.ServiceModel_test.dll.sources
testing_aot_full_interp_System.ServiceModel.dll.sources
testing_aot_hybrid_System.ServiceModel.dll.sources
testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources
unreal_System.ServiceModel.dll.sources
wasm_System.ServiceModel.dll.sources
win32_monodroid_System.ServiceModel_test.dll.exclude.sources
winaot_System.ServiceModel.dll.sources
xammac_System.ServiceModel.dll.sources
xammac_net_4_5_System.ServiceModel.dll.sources
System.ServiceModel.Activation
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.Web
System.ServiceProcess
System.Threading.Tasks.Dataflow
System.Transactions
System.Web
System.Web.Abstractions
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Extensions
System.Web.Extensions.Design
System.Web.Http
System.Web.Http.SelfHost
System.Web.Http.WebHost
System.Web.Mobile
System.Web.Mvc3
System.Web.Razor
System.Web.RegularExpressions
System.Web.Routing
System.Web.Services
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
System.Windows
System.Windows.Forms
System.Windows.Forms.DataVisualization
System.Workflow.Activities
System.Workflow.ComponentModel
System.Workflow.Runtime
System.XML
System.Xaml
System.Xml.Linq
System.Xml.Serialization
SystemWebTestShim
WebMatrix.Data
WindowsBase
aot-compiler
corlib
dlr
doc
legacy
lib
monodoc
notes
reference-assemblies
referencesource
test-helpers
LICENSE
Makefile
Open.snk
README
ecma.pub
mono.pub
mono.snk
msfinal.pub
reactive.pub
silverlight.pub
winfx.pub
winfx3.pub
docs
errors
ilasm
jay
mcs
packages
tests
tools
AUTHORS
COPYING
INSTALL.txt
Makefile
MonoIcon.png
README
ScalableMonoIcon.svg
mkinstalldirs
mk
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
linux-packaging-mono/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseRequestProcessor.cs

119 lines
3.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Text;
using System.IO;
using System.Xml;
using System.Net.Sockets;
namespace System.ServiceModel.Dispatcher
{
internal class BaseRequestProcessor
{
HandlersChain initialize_handlers_chain = new HandlersChain();
HandlersChain process_handlers_chain = new HandlersChain ();
HandlersChain error_handlers_chain = new HandlersChain ();
HandlersChain finalize_handlers_chain = new HandlersChain ();
protected BaseRequestProcessor () { }
protected virtual void ProcessRequest (MessageProcessingContext mrc)
{
initialize_handlers_chain.ProcessRequestChain (mrc);
using (new OperationContextScope (mrc.OperationContext)) {
try {
process_handlers_chain.ProcessRequestChain (mrc);
} catch (IOException e) {
// FIXME?: On dropped connection do not
// dump a stacktrace, but should be safe
// to dump a console message as in
// default exception handler and
// call error_handlers_chain
Console.WriteLine ("I/O Error (Dropped Connection?): " + e.Message);
mrc.ProcessingException = e;
error_handlers_chain.ProcessRequestChain (mrc);
} catch (SocketException e) {
// FIXME?: On dropped connection do not
// dump a stacktrace, but should be safe
// to dump a console message as in
// default exception handler and
// call error_handlers_chain
Console.WriteLine ("SocketExcpetion (Dropped Connection?): " + e.Message);
mrc.ProcessingException = e;
error_handlers_chain.ProcessRequestChain (mrc);
} catch (XmlException e) {
// FIXME?: On dropped connection do not
// dump a stacktrace, but should be safe
// to dump a console message as in
// default exception handler and
// call error_handlers_chain
Console.WriteLine ("XmlException (Dropped Connection?): " + e.Message);
mrc.ProcessingException = e;
error_handlers_chain.ProcessRequestChain (mrc);
} catch (Exception e) {
// FIXME: this is not really expected use of ChannelDispatcher.ErrorHandlers.
// They are now correctly used in process_handler_chain (namely OperationInvokerHandler).
// For this kind of "outsider" exceptions are actually left thrown
// (and could even cause server loop crash in .NET).
Console.WriteLine ("Exception " + e.Message + " " + e.StackTrace);
mrc.ProcessingException = e;
error_handlers_chain.ProcessRequestChain (mrc);
}
finally {
finalize_handlers_chain.ProcessRequestChain (mrc);
}
}
}
public HandlersChain InitializeChain
{
get { return initialize_handlers_chain; }
}
public HandlersChain ProcessingChain
{
get { return process_handlers_chain; }
}
public HandlersChain ErrorChain
{
get { return error_handlers_chain; }
}
public HandlersChain FinalizationChain
{
get { return finalize_handlers_chain; }
}
}
internal class HandlersChain
{
BaseRequestProcessorHandler chain;
public void ProcessRequestChain (MessageProcessingContext mrc)
{
if (chain != null)
chain.ProcessRequestChain (mrc);
}
public HandlersChain AddHandler (BaseRequestProcessorHandler handler)
{
if (chain == null) {
chain = handler;
}
else {
BaseRequestProcessorHandler current = chain;
while (current.Next != null)
current = current.Next;
current.Next = handler;
}
return this;
}
}
}