/// ----------------------------------------------------------------- /// <summary> /// </summary> // ----------------------------------------------------------------- private byte[] HandleTextRequest(string domain, Stream tstream, IOSHttpRequest request, IOSHttpResponse response) { response.ContentType = "application/json"; response.StatusCode = 200; response.KeepAlive = true; ResponseBase resp = null; try { RequestBase req = RequestBase.DeserializeFromTextStream(tstream); if (req == null) { resp = OperationFailed("Failed to deserialize request"); return(Encoding.UTF8.GetBytes(resp.SerializeToString())); } // Check to see if this is an authentication request // Get a complete domain and find the handler if (String.IsNullOrEmpty(req._Domain)) { req._Domain = domain; } resp = InvokeHandler(req); } catch (Exception e) { resp = OperationFailed(String.Format("Fatal error; {0}", e.Message)); } return(Encoding.UTF8.GetBytes(resp.SerializeToString())); }