You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kristian Marinkovic <kr...@porsche.co.at> on 2007/03/01 15:56:23 UTC

T4: render empty Ajax response

hi,

how do i render an empty ajax response?

i'm sending an ajax request to synchronize
the model with the view but i do not need
any information back except an acknowledgement
that my request was received and processed.

g,
kris


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


Re: Re: T4: render empty Ajax response

Posted by Jesse Kuhnert <jk...@gmail.com>.
Oh yeah....You're not meant to call renderResponse() on
ResponseBuilder yourself, that's mostly reserved for internals - but
since I do have a nice public/internal API structure like T5 I have to
expose it to everyone else..

I'm not sure I understand completely, but this could be made much
simpler by doing something like implementing IJSONRender....The
rendering method for that interface will ~only~ be called during json
requests so you don't have to worry about when which method gets
called....

The Autocompleter component does a direct listener callback with json
response as well, so it may be perfect as an example.

On 3/6/07, Kristian Marinkovic <kr...@porsche.co.at> wrote:
> Hi Jesse,
>
> i just want do call the Dojo DojoAjaxResponseBuilder to return a "OK"
> string. But i dont know how to do this from within my component. Anytime i
> obtain the ResponseBuilder from the cycle and call renderResponse i get
> a exception. i know i'm missing something but i didn't figure out what....
> :)
>
> My component looks sth like this
>
> component:
> public abstract class AsyncListenerCaller extends AbstractComponent
> implements IDirect {
> @InjectScript("AsyncListenerCaller.script")
> public abstract IScript getScript();
>
> @InjectObject("infrastructure:listenerInvoker")
> public abstract ListenerInvoker getListenerInvoker();
>
> @InjectObject("service:tapestry.services.Direct")
> public abstract IEngineService getEngine();
>
> protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
>    renderBody(writer, cycle);
>    HashMap<String,Object> scriptParameters = new HashMap<String,Object>(2);
>    scriptParameters.put("href",getLink(cycle).getURL());
>    scriptParameters.put("jsFunctionSuffix", getJsFunctionSuffix());
>    // for rendering scripts
>    PageRenderSupport pageRenderSupport =
> TapestryUtils.getPageRenderSupport(cycle, this);
>    // render script
>    getScript().execute(this, cycle, pageRenderSupport, scriptParameters);
> }
> public ILink getLink(IRequestCycle cycle) {       // creates a ILink
>    DirectServiceParameter dsp = new DirectServiceParameter(this, new
> Object[] {});
>    return getEngine().getLink(false, dsp);
> }
> public void trigger(IRequestCycle cycle) {
>     getListenerInvoker().invokeListener(getListener(), this, cycle);
> }
>
> script:
> <unique>
>    dojo.require("tapestry.event");
> </unique>
> function asyncListener${jsFunctionSuffix}(data) {
>    tapestry.bind("${href}", data, false);
> }
>
> g,
> kris
>
>
>
>
>
>              "Jesse Kuhnert"
>              <jkuhnert@gmail.c
>              om>                                                        An
>                                         "Tapestry users"
>              06.03.2007 06:23           <us...@tapestry.apache.org>
>                                                                      Kopie
>
>               Bitte antworten                                        Thema
>                     an                  Re: T4: render empty Ajax response
>              "Tapestry users"
>              <users@tapestry.a
>                 pache.org>
>
>
>
>
>
>
>
> Don't specify which components to update? Or make it a json render and
> return some meta protocol between your client and server?
>
> On 3/1/07, Kristian Marinkovic <kr...@porsche.co.at> wrote:
> >
> > hi,
> >
> > how do i render an empty ajax response?
> >
> > i'm sending an ajax request to synchronize
> > the model with the view but i do not need
> > any information back except an acknowledgement
> > that my request was received and processed.
> >
> > g,
> > kris
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: Re: T4: render empty Ajax response

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
Hi Jesse,

i just want do call the Dojo DojoAjaxResponseBuilder to return a "OK"
string. But i dont know how to do this from within my component. Anytime i
obtain the ResponseBuilder from the cycle and call renderResponse i get
a exception. i know i'm missing something but i didn't figure out what....
:)

My component looks sth like this

component:
public abstract class AsyncListenerCaller extends AbstractComponent
implements IDirect {
@InjectScript("AsyncListenerCaller.script")
public abstract IScript getScript();

@InjectObject("infrastructure:listenerInvoker")
public abstract ListenerInvoker getListenerInvoker();

@InjectObject("service:tapestry.services.Direct")
public abstract IEngineService getEngine();

protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
   renderBody(writer, cycle);
   HashMap<String,Object> scriptParameters = new HashMap<String,Object>(2);
   scriptParameters.put("href",getLink(cycle).getURL());
   scriptParameters.put("jsFunctionSuffix", getJsFunctionSuffix());
   // for rendering scripts
   PageRenderSupport pageRenderSupport =
TapestryUtils.getPageRenderSupport(cycle, this);
   // render script
   getScript().execute(this, cycle, pageRenderSupport, scriptParameters);
}
public ILink getLink(IRequestCycle cycle) {       // creates a ILink
   DirectServiceParameter dsp = new DirectServiceParameter(this, new
Object[] {});
   return getEngine().getLink(false, dsp);
}
public void trigger(IRequestCycle cycle) {
    getListenerInvoker().invokeListener(getListener(), this, cycle);
}

script:
<unique>
   dojo.require("tapestry.event");
</unique>
function asyncListener${jsFunctionSuffix}(data) {
   tapestry.bind("${href}", data, false);
}

g,
kris




                                                                           
             "Jesse Kuhnert"                                               
             <jkuhnert@gmail.c                                             
             om>                                                        An 
                                        "Tapestry users"                   
             06.03.2007 06:23           <us...@tapestry.apache.org>        
                                                                     Kopie 
                                                                           
              Bitte antworten                                        Thema 
                    an                  Re: T4: render empty Ajax response 
             "Tapestry users"                                              
             <users@tapestry.a                                             
                pache.org>                                                 
                                                                           
                                                                           
                                                                           




Don't specify which components to update? Or make it a json render and
return some meta protocol between your client and server?

On 3/1/07, Kristian Marinkovic <kr...@porsche.co.at> wrote:
>
> hi,
>
> how do i render an empty ajax response?
>
> i'm sending an ajax request to synchronize
> the model with the view but i do not need
> any information back except an acknowledgement
> that my request was received and processed.
>
> g,
> kris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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




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


Re: T4: render empty Ajax response

Posted by Jesse Kuhnert <jk...@gmail.com>.
Don't specify which components to update? Or make it a json render and
return some meta protocol between your client and server?

On 3/1/07, Kristian Marinkovic <kr...@porsche.co.at> wrote:
>
> hi,
>
> how do i render an empty ajax response?
>
> i'm sending an ajax request to synchronize
> the model with the view but i do not need
> any information back except an acknowledgement
> that my request was received and processed.
>
> g,
> kris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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