diff options
author | Jeff Ames | 2007-11-04 14:34:45 +0000 |
---|---|---|
committer | Jeff Ames | 2007-11-04 14:34:45 +0000 |
commit | 2d1c255e8c427c8c595be455e6d7f5c4e01c99a6 (patch) | |
tree | a95f2a5085505192293603f8b0c9df23c4ac7041 /OpenSim/Framework/Servers/RestObjectPoster.cs | |
parent | Applying Teravus patch # 557. Some glue code for the updating of prim's veloc... (diff) | |
download | opensim-SC-2d1c255e8c427c8c595be455e6d7f5c4e01c99a6.zip opensim-SC-2d1c255e8c427c8c595be455e6d7f5c4e01c99a6.tar.gz opensim-SC-2d1c255e8c427c8c595be455e6d7f5c4e01c99a6.tar.bz2 opensim-SC-2d1c255e8c427c8c595be455e6d7f5c4e01c99a6.tar.xz |
normalized line endings
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/RestObjectPoster.cs | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/OpenSim/Framework/Servers/RestObjectPoster.cs b/OpenSim/Framework/Servers/RestObjectPoster.cs index 77660a0..b77cbcc 100644 --- a/OpenSim/Framework/Servers/RestObjectPoster.cs +++ b/OpenSim/Framework/Servers/RestObjectPoster.cs | |||
@@ -1,49 +1,49 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | 2 | using System.IO; |
3 | using System.Net; | 3 | using System.Net; |
4 | using System.Text; | 4 | using System.Text; |
5 | using System.Xml; | 5 | using System.Xml; |
6 | using System.Xml.Serialization; | 6 | using System.Xml.Serialization; |
7 | 7 | ||
8 | 8 | ||
9 | namespace OpenSim.Framework.Servers | 9 | namespace OpenSim.Framework.Servers |
10 | { | 10 | { |
11 | public class RestObjectPoster | 11 | public class RestObjectPoster |
12 | { | 12 | { |
13 | public static void BeginPostObject<TRequest>(string requestUrl, TRequest obj) | 13 | public static void BeginPostObject<TRequest>(string requestUrl, TRequest obj) |
14 | { | 14 | { |
15 | Type type = typeof(TRequest); | 15 | Type type = typeof(TRequest); |
16 | 16 | ||
17 | WebRequest request = WebRequest.Create(requestUrl); | 17 | WebRequest request = WebRequest.Create(requestUrl); |
18 | request.Method = "POST"; | 18 | request.Method = "POST"; |
19 | request.ContentType = "text/xml"; | 19 | request.ContentType = "text/xml"; |
20 | 20 | ||
21 | MemoryStream buffer = new MemoryStream(); | 21 | MemoryStream buffer = new MemoryStream(); |
22 | 22 | ||
23 | XmlWriterSettings settings = new XmlWriterSettings(); | 23 | XmlWriterSettings settings = new XmlWriterSettings(); |
24 | settings.Encoding = Encoding.UTF8; | 24 | settings.Encoding = Encoding.UTF8; |
25 | 25 | ||
26 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) | 26 | using (XmlWriter writer = XmlWriter.Create(buffer, settings)) |
27 | { | 27 | { |
28 | XmlSerializer serializer = new XmlSerializer(type); | 28 | XmlSerializer serializer = new XmlSerializer(type); |
29 | serializer.Serialize(writer, obj); | 29 | serializer.Serialize(writer, obj); |
30 | writer.Flush(); | 30 | writer.Flush(); |
31 | } | 31 | } |
32 | 32 | ||
33 | int length = (int)buffer.Length; | 33 | int length = (int)buffer.Length; |
34 | request.ContentLength = length; | 34 | request.ContentLength = length; |
35 | 35 | ||
36 | Stream requestStream = request.GetRequestStream(); | 36 | Stream requestStream = request.GetRequestStream(); |
37 | requestStream.Write(buffer.ToArray(), 0, length); | 37 | requestStream.Write(buffer.ToArray(), 0, length); |
38 | IAsyncResult result = request.BeginGetResponse(AsyncCallback, request); | 38 | IAsyncResult result = request.BeginGetResponse(AsyncCallback, request); |
39 | } | 39 | } |
40 | 40 | ||
41 | private static void AsyncCallback(IAsyncResult result) | 41 | private static void AsyncCallback(IAsyncResult result) |
42 | { | 42 | { |
43 | WebRequest request = (WebRequest)result.AsyncState; | 43 | WebRequest request = (WebRequest)result.AsyncState; |
44 | using (WebResponse resp = request.EndGetResponse(result)) | 44 | using (WebResponse resp = request.EndGetResponse(result)) |
45 | { | 45 | { |
46 | } | 46 | } |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } \ No newline at end of file | 49 | } \ No newline at end of file |