Add another handler body type: callback #12

Closed
wants to merge 1 commit into
from

2 participants

@lolownia

Hi!

I have a scenario, where I want to return a result of XSLT transformation (that's XML templating). I'm using a Saxon processor, which accepts OutputStream (or Writer) and serializes a formatted xml there.
Ideally this would be response's OutputStream, but in ring 0.3.6 there is no way to do it -- even with java's PipedStreams, the generated body would have to be held in memory and passed to ring-servlet/set-body.
I believe there might be more scenarios like this, and so made this simple addition.

Regards,

Martin.

Marcin Koziej Support returning callback function as a body, which is called with O…
…utputStream of response object.
ed7bc84
@weavejester
Collaborator

This change has been suggested before, but there are a couple of issues with it.

  1. A change like this requires a change to the Ring specification. This should really be first discussed in the Ring group, so that other people have a chance to voice their opinions.
  2. Obviously only one type of callback function can be implemented on the :body key, so we need to be certain that an OutputStream callback is really what we want. Once a decision is made, it's hard to reverse.

In theory, I've got no real problem with this. But please start a thread on the Ring group first, as this merits discussion.

@weavejester weavejester closed this Oct 9, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment