Skip to content

WAComboResponse - a combined buffered / streaming response #591

@GoogleCodeExporter

Description

@GoogleCodeExporter
Currently, a Seaside server adaptor must make an upfront decision about whether 
to allow a Seaside application to support partial responses (i.e., streaming) 
or not. Using WAStreamedResponse for this purpose, there are severe limits as 
it uses an outdated mechanism for streaming (transient http responses). 
WAComboResponse provides an alternative.


From WAComboResponse's class comment:
--------------------------------------
WAComboResponse is a combination of a buffered and a streaming response. By 
default, WAComboResponse will buffer the entire response to be sent at the end 
of the request processing cycle. If streaming is desired, the response can be 
flushed by sending it the #flush message. Flushing a response will sent all 
previously buffered data using chunked transfer-encoding (which preserves 
persistent connections). Clients can flush the response as often as they want 
at appropriate points in their response generation; everything buffered up to 
that point will be sent. For example, a search results page might use something 
like:

renderContentOn: aCanvas
    "Render the search page"

    self renderSearchLabelOn: aCanvas.
    aCanvas flush. "flush before starting search to give immediate feedback"

    self searchResultsDo:[:aResult|
        self renderSearchResultOn: aCanvas.
        aCanvas flush. "flush after each search result"
    ].

After a response has been flushed once, header modifications are no longer 
possible and will raise a WAIllegalStateException.

Server adaptors need to be aware that a committed response must be closed, when 
complete. An uncommitted response should be handled as usual by the server 
adapter.
--------------------------------------

The attached three files provide all necessary changes:
* WAComboResponse.cs provides the implementation of WAComboResponse
* CometFixes.cs provide necessary fixes for Comet.
* ComancheFixes.cs provides an (admittedly ugly) patch for 
WAComancheServerAdaptor to make it streaming

Original issue reported on code.google.com by [email protected] on 5 Aug 2010 at 4:15

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions