.Net/Flex: How to read partial results from URLRequest?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 07:29:46

问题


I'm working on a batch process script that's executed from Flex. The batch script is in a .aspx Page and returns partial results through the following class:

public class ResponseLogger
{

    private HttpResponse _response;

    public ResponseLogger(HttpResponse response)
    {
        this._response = response;
    }

    public void Start()
    {
        _response.Clear();
        _response.ContentType = "text/plain";
        _response.ContentEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
    }

    public void End()
    {
        _response.End();
    }

    public void Br()
    {
        Log("");
    }

    public void Underline(string message)
    {
        Log(message);
        Log("".PadLeft(message.Length, '-'));

    }

    public void Log(string message)
    {
        _response.Write(message + "\n");
        _response.Flush();
    }

}

In my Flex application I'd like to show the result as soon as it's flushed on server side. Can this be done using Actionscript?


回答1:


Short answer, no, you cannot do partial results over HTTP unless you do short/long polling (several http calls per minute). HTTP in it's essence is a request-response protocol.

What you want is a push technology, but I'm not sure if there's a .NET equivalent for this. On the Java side you got BlazeDS or GraniteDS for push messaging.

The other question is why are you results 'partial'?



来源:https://stackoverflow.com/questions/5343718/net-flex-how-to-read-partial-results-from-urlrequest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!