aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorJeff Ames2008-05-16 01:22:11 +0000
committerJeff Ames2008-05-16 01:22:11 +0000
commit65c5efe43b68700bad94076d4cd421160203c5de (patch)
tree589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Framework/Servers
parentThank you very much, mjm for : (diff)
downloadopensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.zip
opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz
opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2
opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs42
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs28
-rw-r--r--OpenSim/Framework/Servers/RestObjectPosterResponse.cs10
-rw-r--r--OpenSim/Framework/Servers/RestStreamHandler.cs2
-rw-r--r--OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs2
5 files changed, 42 insertions, 42 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 50f4e23..1eb1da9 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -82,10 +82,10 @@ namespace OpenSim.Framework.Servers
82 string path = handler.Path; 82 string path = handler.Path;
83 83
84 string handlerKey = GetHandlerKey(httpMethod, path); 84 string handlerKey = GetHandlerKey(httpMethod, path);
85 85
86 if (!m_streamHandlers.ContainsKey(handlerKey)) 86 if (!m_streamHandlers.ContainsKey(handlerKey))
87 { 87 {
88 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey); 88 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
89 m_streamHandlers.Add(handlerKey, handler); 89 m_streamHandlers.Add(handlerKey, handler);
90 } 90 }
91 } 91 }
@@ -135,20 +135,20 @@ namespace OpenSim.Framework.Servers
135 try 135 try
136 { 136 {
137 HttpListenerContext context = (HttpListenerContext) stateinfo; 137 HttpListenerContext context = (HttpListenerContext) stateinfo;
138 138
139 HttpListenerRequest request = context.Request; 139 HttpListenerRequest request = context.Request;
140 HttpListenerResponse response = context.Response; 140 HttpListenerResponse response = context.Response;
141 141
142 response.KeepAlive = false; 142 response.KeepAlive = false;
143 response.SendChunked = false; 143 response.SendChunked = false;
144 144
145 string path = request.RawUrl; 145 string path = request.RawUrl;
146 string handlerKey = GetHandlerKey(request.HttpMethod, path); 146 string handlerKey = GetHandlerKey(request.HttpMethod, path);
147 147
148 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 148 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
149 149
150 IRequestHandler requestHandler; 150 IRequestHandler requestHandler;
151 151
152 if (TryGetStreamHandler(handlerKey, out requestHandler)) 152 if (TryGetStreamHandler(handlerKey, out requestHandler))
153 { 153 {
154 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. 154 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
@@ -156,13 +156,13 @@ namespace OpenSim.Framework.Servers
156 if (requestHandler is IStreamedRequestHandler) 156 if (requestHandler is IStreamedRequestHandler)
157 { 157 {
158 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; 158 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
159 159
160 buffer = streamedRequestHandler.Handle(path, request.InputStream); 160 buffer = streamedRequestHandler.Handle(path, request.InputStream);
161 } 161 }
162 else 162 else
163 { 163 {
164 IStreamHandler streamHandler = (IStreamHandler) requestHandler; 164 IStreamHandler streamHandler = (IStreamHandler) requestHandler;
165 165
166 using (MemoryStream memoryStream = new MemoryStream()) 166 using (MemoryStream memoryStream = new MemoryStream())
167 { 167 {
168 streamHandler.Handle(path, request.InputStream, memoryStream); 168 streamHandler.Handle(path, request.InputStream, memoryStream);
@@ -170,11 +170,11 @@ namespace OpenSim.Framework.Servers
170 buffer = memoryStream.ToArray(); 170 buffer = memoryStream.ToArray();
171 } 171 }
172 } 172 }
173 173
174 request.InputStream.Close(); 174 request.InputStream.Close();
175 response.ContentType = requestHandler.ContentType; 175 response.ContentType = requestHandler.ContentType;
176 response.ContentLength64 = buffer.LongLength; 176 response.ContentLength64 = buffer.LongLength;
177 177
178 try 178 try
179 { 179 {
180 response.OutputStream.Write(buffer, 0, buffer.Length); 180 response.OutputStream.Write(buffer, 0, buffer.Length);
@@ -273,7 +273,7 @@ namespace OpenSim.Framework.Servers
273 return true; 273 return true;
274 } 274 }
275 } 275 }
276 276
277 /// <summary> 277 /// <summary>
278 /// Try all the registered xmlrpc handlers when an xmlrpc request is received. 278 /// Try all the registered xmlrpc handlers when an xmlrpc request is received.
279 /// Sends back an XMLRPC unknown request response if no handler is registered for the requested method. 279 /// Sends back an XMLRPC unknown request response if no handler is registered for the requested method.
@@ -434,7 +434,7 @@ namespace OpenSim.Framework.Servers
434 { 434 {
435 // This is a test. There's a workable alternative.. as this way sucks. 435 // This is a test. There's a workable alternative.. as this way sucks.
436 // We'd like to put this into a text file parhaps that's easily editable. 436 // We'd like to put this into a text file parhaps that's easily editable.
437 // 437 //
438 // For this test to work, I used the following secondlife.exe parameters 438 // For this test to work, I used the following secondlife.exe parameters
439 // "C:\Program Files\SecondLifeWindLight\SecondLifeWindLight.exe" -settings settings_windlight.xml -channel "Second Life WindLight" -set SystemLanguage en-us -loginpage http://10.1.1.2:8002/?show_login_form=TRUE -loginuri http://10.1.1.2:8002 -user 10.1.1.2 439 // "C:\Program Files\SecondLifeWindLight\SecondLifeWindLight.exe" -settings settings_windlight.xml -channel "Second Life WindLight" -set SystemLanguage en-us -loginpage http://10.1.1.2:8002/?show_login_form=TRUE -loginuri http://10.1.1.2:8002 -user 10.1.1.2
440 // 440 //
@@ -461,7 +461,7 @@ namespace OpenSim.Framework.Servers
461 string[] querystringkeys = request.QueryString.AllKeys; 461 string[] querystringkeys = request.QueryString.AllKeys;
462 string[] rHeaders = request.Headers.AllKeys; 462 string[] rHeaders = request.Headers.AllKeys;
463 463
464 464
465 foreach (string queryname in querystringkeys) 465 foreach (string queryname in querystringkeys)
466 { 466 {
467 keysvals.Add(queryname, request.QueryString[queryname]); 467 keysvals.Add(queryname, request.QueryString[queryname]);
@@ -489,7 +489,7 @@ namespace OpenSim.Framework.Servers
489 { 489 {
490 Hashtable responsedata = requestprocessor(keysvals); 490 Hashtable responsedata = requestprocessor(keysvals);
491 DoHTTPGruntWork(responsedata,response); 491 DoHTTPGruntWork(responsedata,response);
492 492
493 //SendHTML500(response); 493 //SendHTML500(response);
494 } 494 }
495 else 495 else
@@ -519,7 +519,7 @@ namespace OpenSim.Framework.Servers
519 contentType = "text/html"; 519 contentType = "text/html";
520 } 520 }
521 521
522 // We're forgoing the usual error status codes here because the client 522 // We're forgoing the usual error status codes here because the client
523 // ignores anything but 200 and 301 523 // ignores anything but 200 and 301
524 524
525 response.StatusCode = 200; 525 response.StatusCode = 200;
@@ -649,10 +649,10 @@ namespace OpenSim.Framework.Servers
649 649
650 public void RemoveStreamHandler(string httpMethod, string path) 650 public void RemoveStreamHandler(string httpMethod, string path)
651 { 651 {
652 string handlerKey = GetHandlerKey(httpMethod, path); 652 string handlerKey = GetHandlerKey(httpMethod, path);
653 653
654 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); 654 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
655 655
656 m_streamHandlers.Remove(handlerKey); 656 m_streamHandlers.Remove(handlerKey);
657 } 657 }
658 658
@@ -660,7 +660,7 @@ namespace OpenSim.Framework.Servers
660 { 660 {
661 m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); 661 m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
662 } 662 }
663 663
664 public string GetHTTP404(string host) 664 public string GetHTTP404(string host)
665 { 665 {
666 string file = Path.Combine(Util.configDir(), "http_404.html"); 666 string file = Path.Combine(Util.configDir(), "http_404.html");
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 811a0db..fcbc5a1 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -44,16 +44,16 @@ namespace OpenSim.Framework.Servers
44 { 44 {
45 get { return m_httpServer; } 45 get { return m_httpServer; }
46 } 46 }
47 47
48 /// <summary> 48 /// <summary>
49 /// Holds the non-viewer statistics collection object for this service/server 49 /// Holds the non-viewer statistics collection object for this service/server
50 /// </summary> 50 /// </summary>
51 protected IStatsCollector m_stats; 51 protected IStatsCollector m_stats;
52 52
53 public BaseOpenSimServer() 53 public BaseOpenSimServer()
54 { 54 {
55 m_startuptime = DateTime.Now; 55 m_startuptime = DateTime.Now;
56 } 56 }
57 57
58 /// <summary> 58 /// <summary>
59 /// Should be overriden by descendents if they need to perform extra shutdown processing 59 /// Should be overriden by descendents if they need to perform extra shutdown processing
@@ -66,7 +66,7 @@ namespace OpenSim.Framework.Servers
66 } 66 }
67 Environment.Exit(0); 67 Environment.Exit(0);
68 } 68 }
69 69
70 /// <summary> 70 /// <summary>
71 /// Runs commands issued by the server console from the operator 71 /// Runs commands issued by the server console from the operator
72 /// </summary> 72 /// </summary>
@@ -75,17 +75,17 @@ namespace OpenSim.Framework.Servers
75 public virtual void RunCmd(string command, string[] cmdparams) 75 public virtual void RunCmd(string command, string[] cmdparams)
76 { 76 {
77 switch (command) 77 switch (command)
78 { 78 {
79 case "help": 79 case "help":
80 Notice("quit - equivalent to shutdown."); 80 Notice("quit - equivalent to shutdown.");
81 81
82 if (m_stats != null) 82 if (m_stats != null)
83 Notice("show stats - statistical information for this server"); 83 Notice("show stats - statistical information for this server");
84 84
85 Notice("show uptime - show server startup and uptime."); 85 Notice("show uptime - show server startup and uptime.");
86 Notice("shutdown - shutdown the server.\n"); 86 Notice("shutdown - shutdown the server.\n");
87 break; 87 break;
88 88
89 case "show": 89 case "show":
90 if (cmdparams.Length > 0) 90 if (cmdparams.Length > 0)
91 { 91 {
@@ -96,10 +96,10 @@ namespace OpenSim.Framework.Servers
96 case "quit": 96 case "quit":
97 case "shutdown": 97 case "shutdown":
98 Shutdown(); 98 Shutdown();
99 break; 99 break;
100 } 100 }
101 } 101 }
102 102
103 /// <summary> 103 /// <summary>
104 /// Outputs to the console information about the region 104 /// Outputs to the console information about the region
105 /// </summary> 105 /// </summary>
@@ -107,18 +107,18 @@ namespace OpenSim.Framework.Servers
107 public virtual void Show(string ShowWhat) 107 public virtual void Show(string ShowWhat)
108 { 108 {
109 switch (ShowWhat) 109 switch (ShowWhat)
110 { 110 {
111 case "stats": 111 case "stats":
112 if (m_stats != null) 112 if (m_stats != null)
113 { 113 {
114 Notice(m_stats.Report()); 114 Notice(m_stats.Report());
115 } 115 }
116 break; 116 break;
117 117
118 case "uptime": 118 case "uptime":
119 Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); 119 Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
120 Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); 120 Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
121 break; 121 break;
122 } 122 }
123 } 123 }
124 124
diff --git a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
index 1410afd..05bfaa1 100644
--- a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
+++ b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
@@ -38,12 +38,12 @@ namespace OpenSim.Framework.Servers
38 38
39 /// <summary> 39 /// <summary>
40 /// Makes an asynchronous REST request with a callback to invoke with the response. 40 /// Makes an asynchronous REST request with a callback to invoke with the response.
41 /// </summary> 41 /// </summary>
42 public class RestObjectPosterResponse<TResponse> 42 public class RestObjectPosterResponse<TResponse>
43 { 43 {
44// private static readonly log4net.ILog m_log 44// private static readonly log4net.ILog m_log
45// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 public ReturnResponse<TResponse> ResponseCallback; 47 public ReturnResponse<TResponse> ResponseCallback;
48 48
49 public void BeginPostObject<TRequest>(string requestUrl, TRequest obj) 49 public void BeginPostObject<TRequest>(string requestUrl, TRequest obj)
@@ -87,11 +87,11 @@ namespace OpenSim.Framework.Servers
87 TResponse deserial; 87 TResponse deserial;
88 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); 88 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
89 Stream stream = resp.GetResponseStream(); 89 Stream stream = resp.GetResponseStream();
90 90
91 // This is currently a bad debug stanza since it gobbles us the response... 91 // This is currently a bad debug stanza since it gobbles us the response...
92// StreamReader reader = new StreamReader(stream); 92// StreamReader reader = new StreamReader(stream);
93// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); 93// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
94 94
95 deserial = (TResponse) deserializer.Deserialize(stream); 95 deserial = (TResponse) deserializer.Deserialize(stream);
96 96
97 if (deserial != null && ResponseCallback != null) 97 if (deserial != null && ResponseCallback != null)
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs
index cab5208..76dbd73 100644
--- a/OpenSim/Framework/Servers/RestStreamHandler.cs
+++ b/OpenSim/Framework/Servers/RestStreamHandler.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Framework.Servers
34 { 34 {
35 private RestMethod m_restMethod; 35 private RestMethod m_restMethod;
36 36
37 public RestMethod Method 37 public RestMethod Method
38 { 38 {
39 get { return m_restMethod; } 39 get { return m_restMethod; }
40 } 40 }
diff --git a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
index 103fbe5..1b8e4ea 100644
--- a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
+++ b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Framework.Servers
75 using (WebResponse resp = request.GetResponse()) 75 using (WebResponse resp = request.GetResponse())
76 { 76 {
77 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); 77 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
78 deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream()); 78 deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream());
79 } 79 }
80 return deserial; 80 return deserial;
81 } 81 }