diff options
Diffstat (limited to 'Common-Source/XmlRpcCS/XmlRpcBoxcarRequest.cs')
-rw-r--r-- | Common-Source/XmlRpcCS/XmlRpcBoxcarRequest.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Common-Source/XmlRpcCS/XmlRpcBoxcarRequest.cs b/Common-Source/XmlRpcCS/XmlRpcBoxcarRequest.cs new file mode 100644 index 0000000..f87f7a5 --- /dev/null +++ b/Common-Source/XmlRpcCS/XmlRpcBoxcarRequest.cs | |||
@@ -0,0 +1,51 @@ | |||
1 | namespace Nwc.XmlRpc | ||
2 | { | ||
3 | using System; | ||
4 | using System.Collections; | ||
5 | using System.IO; | ||
6 | using System.Xml; | ||
7 | using System.Net; | ||
8 | using System.Text; | ||
9 | using System.Reflection; | ||
10 | |||
11 | /// <summary>Class that collects individual <c>XmlRpcRequest</c> objects and submits them as a <i>boxcarred</i> request.</summary> | ||
12 | /// <remarks>A boxcared request is when a number of request are collected before being sent via XML-RPC, and then are sent via | ||
13 | /// a single HTTP connection. This results in a speed up from reduced connection time. The results are then retuned collectively | ||
14 | /// as well. | ||
15 | ///</remarks> | ||
16 | /// <seealso cref="XmlRpcRequest"/> | ||
17 | public class XmlRpcBoxcarRequest : XmlRpcRequest | ||
18 | { | ||
19 | /// <summary>ArrayList to collect the requests to boxcar.</summary> | ||
20 | public IList Requests = new ArrayList(); | ||
21 | |||
22 | /// <summary>Basic constructor.</summary> | ||
23 | public XmlRpcBoxcarRequest() | ||
24 | { | ||
25 | } | ||
26 | |||
27 | /// <summary>Returns the <c>String</c> "system.multiCall" which is the server method that handles boxcars.</summary> | ||
28 | public override String MethodName | ||
29 | { | ||
30 | get { return "system.multiCall"; } | ||
31 | } | ||
32 | |||
33 | /// <summary>The <c>ArrayList</c> of boxcarred <paramref>Requests</paramref> as properly formed parameters.</summary> | ||
34 | public override IList Params | ||
35 | { | ||
36 | get { | ||
37 | _params.Clear(); | ||
38 | ArrayList reqArray = new ArrayList(); | ||
39 | foreach (XmlRpcRequest request in Requests) | ||
40 | { | ||
41 | Hashtable requestEntry = new Hashtable(); | ||
42 | requestEntry.Add(XmlRpcXmlTokens.METHOD_NAME, request.MethodName); | ||
43 | requestEntry.Add(XmlRpcXmlTokens.PARAMS, request.Params); | ||
44 | reqArray.Add(requestEntry); | ||
45 | } | ||
46 | _params.Add(reqArray); | ||
47 | return _params; | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } | ||