当前位置: 首页>>代码示例>>C#>>正文


C# IOSHttpResponse类代码示例

本文整理汇总了C#中IOSHttpResponse的典型用法代码示例。如果您正苦于以下问题:C# IOSHttpResponse类的具体用法?C# IOSHttpResponse怎么用?C# IOSHttpResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IOSHttpResponse类属于命名空间,在下文中一共展示了IOSHttpResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Handle

        public override byte[] Handle(string path, Stream requestData,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            // path = /wifi/...
            //m_log.DebugFormat("[Wifi]: path = {0}", path);
            //m_log.DebugFormat("[Wifi]: ip address = {0}", httpRequest.RemoteIPEndPoint);
            //foreach (object o in httpRequest.Query.Keys)
            //    m_log.DebugFormat("  >> {0}={1}", o, httpRequest.Query[o]);

            string result = string.Empty;
            try
            {
                Request request = RequestFactory.CreateRequest(string.Empty, httpRequest, Localization.GetLanguageInfo(httpRequest.Headers.Get("accept-language")));
                Environment env = new Environment(request);

                result = m_WebApp.Services.LogoutRequest(env);

                httpResponse.ContentType = "text/html";
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[LOGOUT HANDLER]: Exception {0}: {1}", e.Message, e.StackTrace);
            }

            return WebAppUtils.StringToBytes(result);
        }
开发者ID:ffoliveira,项目名称:diva-distribution,代码行数:26,代码来源:WifiLogoutHandler.cs

示例2: FetchInventoryRequest

        public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
//            m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capabilty request");

            OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
            OSDArray itemsRequested = (OSDArray)requestmap["items"];

            string reply;
            LLSDFetchInventory llsdReply = new LLSDFetchInventory();

            foreach (OSDMap osdItemId in itemsRequested)
            {
                UUID itemId = osdItemId["item_id"].AsUUID();

                InventoryItemBase item = m_inventoryService.GetItem(new InventoryItemBase(itemId, m_agentID));

                if (item != null)
                {
                    // We don't know the agent that this request belongs to so we'll use the agent id of the item
                    // which will be the same for all items.
                    llsdReply.agent_id = item.Owner;

                    llsdReply.items.Array.Add(ConvertInventoryItem(item));
                }
            }

            reply = LLSDHelpers.SerialiseLLSDReply(llsdReply);

            return reply;
        }
开发者ID:szielins,项目名称:opensim,代码行数:30,代码来源:FetchInventory2Handler.cs

示例3: Handle

        public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            m_log.Info("-");
            Dictionary<string, object> request = Werkzeuge.createDictionaryFromHttpRequest(httpRequest);
            string data = Werkzeuge.createPOSTDataFromHttpRequest(httpRequest);

            httpResponse.StatusCode = (int)HttpStatusCode.OK;
            httpResponse.StatusDescription = "OK";
            httpResponse.ContentType = "test/plain";
            
            if (Werkzeuge.getValueFromDictionary(request, "methode").ToLower() == "stop")
            {
                m_log.Info("[WakeUpService] Region " + Werkzeuge.getValueFromDictionary(request, "uuid") + " wants to be stopped.");

                restData restDataObject = new restData();
                restDataObject.regionUUID = UUID.Parse(Werkzeuge.getValueFromDictionary(request, "uuid"));
                restDataObject.postDaten = Encoding.ASCII.GetBytes(data);
                restDataObject.startURI = Werkzeuge.getValueFromDictionary(request, "starturl");
                restDataObject.stoptURI = Werkzeuge.getValueFromDictionary(request, "stopurl");
                restDataObject.daten = data;
                restDataManager.add(restDataObject);

                Werkzeuge.makeHTTPCall(restDataObject.stoptURI, restDataObject.postDaten);
            }

            StreamWriter sw = new StreamWriter(httpResponse.OutputStream);
            sw.Write("ok");

            return new byte[0];
        }
开发者ID:ChrisWeymann,项目名称:OpenSim-Fuzzy-Grid,代码行数:30,代码来源:ShutDownServiceConnector.cs

示例4: Handle

        public override byte[] Handle(string path, Stream requestData,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            string result = string.Empty;
            try
            {
                Request request = RequestFactory.CreateRequest(string.Empty, httpRequest);
                Diva.Wifi.Environment env = new Diva.Wifi.Environment(request);

                string resource = GetParam(path);
                //m_log.DebugFormat("[XXX]: resource {0}", resource);
                if (resource.StartsWith("/data/simulators"))
                {
                    result = m_WebApp.Services.ConsoleSimulatorsRequest(env);
                    httpResponse.ContentType = "application/xml";
                }
                else if (resource.StartsWith("/heartbeat"))
                {
                    result = m_WebApp.Services.ConsoleHeartbeat(env);
                    httpResponse.ContentType = "application/xml";
                }
                else
                {
                    result = m_WebApp.Services.ConsoleRequest(env);
                    httpResponse.ContentType = "text/html";
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[CONSOLE HANDLER]: Exception {0}: {1}", e.Message, e.StackTrace);
            }

            return WebAppUtils.StringToBytes(result);
        }
开发者ID:JAllard,项目名称:diva-distribution,代码行数:34,代码来源:WifiConsoleHandler.cs

示例5: ProcessRequest

        protected override byte[] ProcessRequest(string path, Stream requestData,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            httpResponse.ContentType = "image/jpeg";

//            StreamReader sr = new StreamReader(requestData);
//            string body = sr.ReadToEnd();
//            sr.Close();
//            body = body.Trim();

            try
            {
                Dictionary<string, object> request =
                        new Dictionary<string, object>();
                foreach (string name in httpRequest.QueryString)
                    request[name] = httpRequest.QueryString[name];

                return SendWorldView(request);
            }
            catch (Exception e)
            {
                m_log.Debug("[WORLDVIEW]: Exception: " + e.ToString());
            }

            return new Byte[0];
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:26,代码来源:WorldViewRequestHandler.cs

示例6: ProcessRequest

        protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            // Try to parse the texture ID from the request URL
            NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
            string names = query.GetOne("names");
            string psize = query.GetOne("page_size");
            string pnumber = query.GetOne("page");

            if (m_PeopleService == null)
                return FailureResponse(names, (int)System.Net.HttpStatusCode.InternalServerError, httpResponse);

            if (string.IsNullOrEmpty(names) || names.Length < 3)
                return FailureResponse(names, (int)System.Net.HttpStatusCode.BadRequest, httpResponse);

            m_log.DebugFormat("[AVATAR PICKER SEARCH]: search for {0}", names);

            int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
            int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
            
            // Full content request
            httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
            //httpResponse.ContentLength = ??;
            httpResponse.ContentType = "application/llsd+xml";

            List<UserData> users = m_PeopleService.GetUserData(names, page_size, page_number);

            LLSDAvatarPicker osdReply = new LLSDAvatarPicker();
            osdReply.next_page_url = httpRequest.RawUrl;
            foreach (UserData u in users)
                osdReply.agents.Array.Add(ConvertUserData(u));

            string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
            return System.Text.Encoding.UTF8.GetBytes(reply);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:34,代码来源:AvatarPickerSearchHandler.cs

示例7: Handle

        public override byte[] Handle(string path, Stream requestData,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            // path = /wifi/...
            //m_log.DebugFormat("[Wifi]: path = {0}", path);
            //m_log.DebugFormat("[Wifi]: ip address = {0}", httpRequest.RemoteIPEndPoint);
            //foreach (object o in httpRequest.Query.Keys)
            //    m_log.DebugFormat("  >> {0}={1}", o, httpRequest.Query[o]);
            httpResponse.ContentType = "text/html";
            string resource = GetParam(path);
            //m_log.DebugFormat("[USER ACCOUNT HANDLER GET]: resource {0}", resource);

            Request request = WifiUtils.CreateRequest(string.Empty, httpRequest);
            Diva.Wifi.Environment env = new Diva.Wifi.Environment(request);

            string result = string.Empty;
            UUID userID = UUID.Zero;
            if (resource == string.Empty || resource == "/")
            {
                result = m_WebApp.Services.NewAccountGetRequest(env);
            }
            else
            {
                //UUID.TryParse(resource.Trim(new char[] {'/'}), out userID);
                if (resource.Trim(new char[] {'/'}).StartsWith("edit"))
                    result = m_WebApp.Services.UserAccountGetRequest(env, userID);
            }

            return WifiUtils.StringToBytes(result);
        }
开发者ID:kenvc,项目名称:diva-distribution,代码行数:30,代码来源:WifiUserAccountHandlers.cs

示例8: ProcessRequest

        protected override byte[] ProcessRequest(string path, Stream request,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            string[] p = SplitParams(path);

            if (p.Length > 0)
            {
                switch (p[0])
                {
                case "plain":
                    StreamReader sr = new StreamReader(request);
                    string body = sr.ReadToEnd();
                    sr.Close();

                    return DoPlainMethods(body);
                case "crypt":
                    byte[] buffer = new byte[request.Length];
                    long length = request.Length;
                    if (length > 16384)
                        length = 16384;
                    request.Read(buffer, 0, (int)length);

                    return DoEncryptedMethods(buffer);
                }
            }
            return new byte[0];
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:27,代码来源:AuthenticationServerPostHandler.cs

示例9: ProcessRequest

        protected override byte[] ProcessRequest(string path, Stream request,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            AssetBase asset;
            XmlSerializer xs = new XmlSerializer(typeof(AssetBase));

            try
            {
                asset = (AssetBase)xs.Deserialize(request);
            }
            catch (Exception)
            {
                httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
                return null;
            }

            string[] p = SplitParams(path);
            if (p.Length > 0)
            {
                string id = p[0];
                bool result = m_AssetService.UpdateContent(id, asset.Data);

                xs = new XmlSerializer(typeof(bool));
                return ServerUtils.SerializeResult(xs, result);
            }
            else
            {
                string id = m_AssetService.Store(asset);

                xs = new XmlSerializer(typeof(string));
                return ServerUtils.SerializeResult(xs, id);
            }
        }
开发者ID:RutgersUniversityVirtualWorlds,项目名称:opensim,代码行数:33,代码来源:AssetServerPostHandler.cs

示例10: ProcessRequest

        protected override byte[] ProcessRequest(string path, Stream request,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            bool result = false;

            string[] p = SplitParams(path);

            if (p.Length > 0)
            {
                if (m_allowedTypes != AllowedRemoteDeleteTypes.None)
                {
                    string assetID = p[0];

                    AssetBase asset = m_AssetService.Get(assetID);
                    if (asset != null)
                    {
                        if (m_allowedTypes == AllowedRemoteDeleteTypes.All
                            || (int)(asset.Flags & AssetFlags.Maptile) != 0)
                        {
                            result = m_AssetService.Delete(assetID);
                        }
                        else
                        {
                            m_log.DebugFormat(
                                "[ASSET SERVER DELETE HANDLER]: Request to delete asset {0}, but type is {1} and allowed remote delete types are {2}",
                                assetID, (AssetFlags)asset.Flags, m_allowedTypes);
                        }
                    }
                }
            }

            XmlSerializer xs = new XmlSerializer(typeof(bool));
            return ServerUtils.SerializeResult(xs, result);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:34,代码来源:AssetServerDeleteHandler.cs

示例11: Handle

        public override byte[] Handle(string path, Stream requestData,
                IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            string resource = GetParam(path);
            resource = resource.Trim(WebAppUtils.DirectorySeparatorChars);
            string resourcePath = System.IO.Path.Combine(m_LocalPath, resource);
            resourcePath = Uri.UnescapeDataString(resourcePath);
            m_log.DebugFormat("[Wifi]: resourcePath {0}", resourcePath);

            string type = WebAppUtils.GetContentType(resource);
            httpResponse.ContentType = type;
            //m_log.DebugFormat("[Wifi]: ContentType {0}", type);
            if (type.StartsWith("image"))
                return WebAppUtils.ReadBinaryResource(new string[] {resourcePath});

            if (type.StartsWith("application") || type.StartsWith("text"))
            {
                string res = WebAppUtils.ReadTextResource(new string[] {resourcePath}, WebApp.MissingPage, true);
                return WebAppUtils.StringToBytes(res);
            }

            m_log.WarnFormat("[Wifi]: Could not find resource {0} in local path {1}", resource, m_LocalPath);
            httpResponse.ContentType = "text/plain";
            string result = "Boo!";
            return WebAppUtils.StringToBytes(result);
        }
开发者ID:MelanieT,项目名称:diva-distribution,代码行数:26,代码来源:WifiGetHandler.cs

示例12: OKResponse

 private byte[] OKResponse(IOSHttpResponse httpResponse)
 {
     m_log.Debug("[HELO]: hi, GET was called");
     httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
     httpResponse.StatusCode = (int)HttpStatusCode.OK;
     httpResponse.StatusDescription = "OK";
     return new byte[0];
 }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:8,代码来源:HeloServerConnector.cs

示例13: Handle

        public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            byte[] data = ReadFully(request);
            string param = GetParam(path);
            string responseString = m_method(data, path, param);

            return Encoding.UTF8.GetBytes(responseString);
        }
开发者ID:JAllard,项目名称:opensim,代码行数:8,代码来源:BinaryStreamHandler.cs

示例14: Handle

 public override byte[] Handle(string path, Stream request,
         IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
 {
     // Not implemented yet
     Console.WriteLine("--- Get region --- " + path);
     httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
     return new byte[] { };
 }
开发者ID:4U2NV,项目名称:opensim,代码行数:8,代码来源:NeighbourHandlers.cs

示例15: Handle

        public virtual void Handle(
            string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            RequestsReceived++;

            ProcessRequest(path, request, response, httpRequest, httpResponse);

            RequestsHandled++;
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:9,代码来源:BaseOutputStreamHandler.cs


注:本文中的IOSHttpResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。