Beispiel #1
0
    void http_onReceieve(HttpTask task, string acknowlege)
    {
        if (task.request is HttpRequest)
        {
            if (Utils.checkJsonFormat(acknowlege))
            {
                HttpResponseFactory.createResponse(task, acknowlege);
                // ... TO DO.  notify event center
                if (Http_OnReceive != null)
                {
                    Http_OnReceive(task);
                }

                HttpRequest curRequest = task.request as HttpRequest;
                if (!Utils.inArray <RequestType>(curRequest.Type, NonHttpDataCompleteness))
                {
                    if (httpDataCom != null)
                    {
                        httpDataCom.incHttpRequestNo(curRequest);
                    }
                }
            }
            else
            {
                http_onException(task, acknowlege);
            }
        }
        else if (task.request is ThirdPartyHttpRequest)
        {
            task.response = new ThirdPartyResponse(acknowlege);

            if (Http_OnReceive != null)
            {
                Http_OnReceive(task);
            }
        }
        else if (task.request is HttpDownloadRequest)
        {
            task.response = new HttpDownloadResponse();

            if (Http_OnReceive != null)
            {
                Http_OnReceive(task);
            }
        }
    }