You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Geoffrey Wiseman <ge...@gmail.com> on 2009/04/27 23:12:18 UTC

TextStreamResponse - TypeError

Probably something really basic that I'm missing here -- I'm hoping one of
you already knows the answer.  This is my first time trying
TextStreamResponse for an ajax action link.

The .tml has bits like this:
        <t:zone t:id="actionResults" />

        <t:grid ...>
            <t:parameter name="actionsCell"><a t:type="actionLink"
t:id="invite" context="${item.id}"
zone="actionResults">invite</a></t:parameter>
        </t:grid>

And the .java has this:
    public StreamResponse onActionFromInvite( EventContext context ) {
        return new TextStreamResponse("text/html","Action taken.");
    }

And I'm getting:
Client exception processing response: TypeError: reply is null

Anything leap out as obviously wrong, or am I going to have to diagnose
further?

  - Geoffrey
-- 
Geoffrey Wiseman
http://www.geoffreywiseman.ca/

Re: TextStreamResponse - TypeError

Posted by Geoffrey Wiseman <ge...@gmail.com>.
On Mon, Apr 27, 2009 at 5:20 PM, Howard Lewis Ship <hl...@gmail.com> wrote:

> Yes, the client-side logic expects a JSON response in a particular
> format; this format includes the content to put into the Zone, but
> also JavaScript libraries to include, and JavaScript to execute after
> the content is loaded ... and in 5.1 it may also include updates for
> other zones.
>

Ah, I see -- so TextResponseStream is not a way to render simpler content
for a zone update.  I had a single string, and a block seemed excessive, I
thought I'd check the alternatives.  I already shifted back to a block in
the meantime, so I'll stick with that.


> Another alternative: don't use the zone parameter of ActionLink, but
> provide your own JS to send the request and interpret the response,
> and update the Zone on the client side.
>

[nod].  Streamlined, but a lot more work.  ;)

Thanks,

  - Geoffrey
-- 
Geoffrey Wiseman
http://www.geoffreywiseman.ca/

Re: TextStreamResponse - TypeError

Posted by Howard Lewis Ship <hl...@gmail.com>.
Yes, the client-side logic expects a JSON response in a particular
format; this format includes the content to put into the Zone, but
also JavaScript libraries to include, and JavaScript to execute after
the content is loaded ... and in 5.1 it may also include updates for
other zones.

But a <t:block> in your template with the desired text, @Inject the
Block into your page, and return the Block.

Alternately, you can return a JSONObject as the response, but you'd
need to know the Tapestry format expected by the client.

Another alternative: don't use the zone parameter of ActionLink, but
provide your own JS to send the request and interpret the response,
and update the Zone on the client side.

On Mon, Apr 27, 2009 at 2:12 PM, Geoffrey Wiseman
<ge...@gmail.com> wrote:
> Probably something really basic that I'm missing here -- I'm hoping one of
> you already knows the answer.  This is my first time trying
> TextStreamResponse for an ajax action link.
>
> The .tml has bits like this:
>        <t:zone t:id="actionResults" />
>
>        <t:grid ...>
>            <t:parameter name="actionsCell"><a t:type="actionLink"
> t:id="invite" context="${item.id}"
> zone="actionResults">invite</a></t:parameter>
>        </t:grid>
>
> And the .java has this:
>    public StreamResponse onActionFromInvite( EventContext context ) {
>        return new TextStreamResponse("text/html","Action taken.");
>    }
>
> And I'm getting:
> Client exception processing response: TypeError: reply is null
>
> Anything leap out as obviously wrong, or am I going to have to diagnose
> further?
>
>  - Geoffrey
> --
> Geoffrey Wiseman
> http://www.geoffreywiseman.ca/
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

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