1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
//
// System.Runtime.Remoting.Channels.CORBA.CORBAServerFormatterSink.cs
//
// Author: Dietmar Maurer (dietmar@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
using System.Collections;
using System.IO;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Channels.CORBA {
public class CORBAServerFormatterSink : IServerChannelSink, IChannelSinkBase
{
IServerChannelSink next_sink;
CDRFormatter format = new CDRFormatter ();
public CORBAServerFormatterSink (IServerChannelSink nextSink)
{
next_sink = nextSink;
}
public IServerChannelSink NextChannelSink {
get {
return next_sink;
}
}
public IDictionary Properties {
get {
return null;
}
}
[MonoTODO]
public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
IMessage msg, ITransportHeaders headers, Stream stream)
{
throw new NotImplementedException ();
}
public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
IMessage msg, ITransportHeaders headers)
{
// never called
throw new NotSupportedException ();
}
public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
IMessage requestMsg,
ITransportHeaders requestHeaders,
Stream requestStream,
out IMessage responseMsg,
out ITransportHeaders responseHeaders,
out Stream responseStream)
{
IMessage call;
string uri = (string)requestHeaders ["_requestUri"];
if (requestMsg == null) {
call = (IMessage)format.DeserializeRequest (requestStream, uri);
} else {
call = requestMsg;
}
next_sink.ProcessMessage (sinkStack, call, requestHeaders, null,
out responseMsg, out responseHeaders, out responseStream);
responseStream = new MemoryStream ();
format.SerializeResponse (responseStream, responseMsg);
return ServerProcessing.Complete;
}
}
}
|