本文介绍了.Net/Flex:如何从 URLRequest 读取部分结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在处理从 Flex 执行的批处理脚本.批处理脚本位于 .aspx 页面中,并通过以下类返回部分结果:

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();
    }

}

在我的 Flex 应用程序中,我想在服务器端刷新后立即显示结果.这可以使用 Actionscript 完成吗?

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?

推荐答案

简短的回答,不,除非您进行短/长轮询(每分钟多次 http 调用),否则您无法通过 HTTP 获得部分结果.HTTP本质上是一个请求-响应协议.

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.

您想要的是推送技术,但我不确定是否有 .NET 等效项.在 Java 方面,您使用 BlazeDS 或 GraniteDS 来推送消息.

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'?

这篇关于.Net/Flex:如何从 URLRequest 读取部分结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 14:38