On Thu, 26 Sep 2013 07:43:44 -0300, Jaroslav Ciml <ci...@centrum.cz> wrote:

Hi,

Hi!

Is returning an StreamResponse instance from EventLink handler a good practice?

Yep! Why not? :)

When that StreamResponse is only used inside a page or component, it makes sense for its event handler to be there. On the other hand, if that's, for example, streaming images from a data store, as these images could be used in many places, I prefer to put this inside a dedicated page and return the StreamResource on its onActivate() method.

I have the following link in the template file.

<t:eventlink event="exportToCsv">
    ${message:exportToCsv}
</t:eventlink>

And the following method handles the event in java file.

@OnEvent("exportToCsv")
StreamResponse exportToCsv()
{
    return new TextStreamResponse("text/plain", "Just a test!");
}

If I click the event link, I get the exception

"Sanity check - neither a stream response nor a redirect response was generated for this action request."

Weird. Which Tapestry version? I'll try to reproduce it here.

However, this occurs just for a short response. If the response is long enough to be split into at least two chunks, everithing is fine.

Define "chunk", please. :)

--
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to