Project

General

Profile

ResponseContinuation Problem

Added by Daniel Walter about 13 years ago

Hi,

i have tested the ResponseContinuation example from here http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WResource.html

for debugging purpose i added some outputs to the code like this:

void handleRequest(const Wt::Http::Request& request, Wt::Http::Response& response) {
    // see if this request is for a continuation:
    Wt::Http::ResponseContinuation *continuation = request.continuation();

    // calculate the current start
    int iteration = continuation ? boost::any_cast<int>(continuation->data()) : 0;
    if (iteration == 0)
        response.setMimeType("application/xml");

    int last = std::min(10, iteration + 2);
    std::cout << "RSSFeed: last: " << last <<  std::endl;

    for (int i = iteration; i < last; ++i)
    {
        response.out() << "Data item " << i << std::endl;
        std::cout << "RSSFeed: " << i <<  std::endl;
    }

    // if we have not yet finished, create a continuation to serve more
    if (last < 10) {
        std::cout << "RSSFeed: continuation" <<  std::endl;
        continuation = response.createContinuation();
        // remember what to do next
        continuation->setData(last);
    }
}

if i fetch it with wget i get some really crappy data:

wget http://localhost:8080/feed/rss2 -O-

Data item 0
Data item 1
ata item 6
Data item 7
ata item 8
Data item 9
ata item 6
Data item 7
ata item 8
Data item 9

But the cout ouput of the programm looks good:

RSSFeed: last: 2
RSSFeed: 0
RSSFeed: 1
RSSFeed: continuation
RSSFeed: last: 4
RSSFeed: 2
RSSFeed: 3
RSSFeed: continuation
RSSFeed: last: 6
RSSFeed: 4
RSSFeed: 5
RSSFeed: continuation
RSSFeed: last: 8
RSSFeed: 6
RSSFeed: 7
RSSFeed: continuation
RSSFeed: last: 10
RSSFeed: 8
RSSFeed: 9

What is wrong with that?

Regards,

Daniel


Replies (3)

RE: ResponseContinuation Problem - Added by Wim Dumon about 13 years ago

Hi Daniel,

That's a bug in wt. What version of Wt are you using?

BR,

Wim.

RE: ResponseContinuation Problem - Added by Daniel Walter about 13 years ago

Hi Wim,

i am using the latest git version.

Regards,

Daniel

RE: ResponseContinuation Problem - Added by Wim Dumon about 13 years ago

I created a bug report (#810). We'll fix this soon.

Maybe in the meantime you can work around this by trying to avoid the use of continuations?

    (1-3/3)