You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tony Nelson <tn...@starpoint.com> on 2013/08/15 18:42:18 UTC

ActivationContext messing up more AJAX calls

Our pages all extend a common layout, that has a simple value that we update every minute with an ajax call.

The handler is in the component class for the layout, and is very simple:

    public JSONObject onUpdateAlertCount() {
        return request.isXHR() ? new JSONObject("alertCount", getAlertCount()) : null;
    }


We generate the URL for this using ComponentResources:

        Link link = componentResources.createEventLink("updateAlertCount");
        JSONObject specs = new JSONObject();
        specs.put("timeout", "60s");
        specs.put("url", link.toAbsoluteURI());
        javaScriptSupport.addInitializerCall("alertCount", specs);

This ends with URLs like:

http://localhost:8080/instihire/index.layout:updatealertcount http://localhost:8080/instihire/jacket/list.layout:updatealertcount

Which work just fine.

My page with the ActivationContext generates this URL

http://localhost:8080/instihire/jacket/view.layout:updatealertcount?t:ac=98298

This call fails very quietly.  I don't see anything in the Jetty console, and I only noticed it because I added a global ajax error handler that logs any exceptions to the console.

event: [object Object] GlobalErrorHandler.js:12<http://localhost:8080/instihire/assets/6.0.0.1376577187577/ctx/js/GlobalErrorHandler.js>
jqxhr: {"readyState":0,"responseText":"","status":0,"statusText":"error"} GlobalErrorHandler.js:13<http://localhost:8080/instihire/assets/6.0.0.1376577187577/ctx/js/GlobalErrorHandler.js>
settings: {"url":"http://localhost:8080/instihire/jacket/view.layout:updatealertcount?t:ac=98298","isLocal":false,"global":true,"type":"GET","contentType":"application/x-www-form-urlencoded; charset=UTF-8","processData":true,"async":true,"accepts":{"xml":"application/xml, text/xml","html":"text/html","text":"text/plain","json":"application/json, text/javascript","*":"*/*","script":"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},"contents":{"xml":{},"html":{},"json":{},"script":{}},"responseFields":{"xml":"responseXML","text":"responseText"},"converters":{"text html":true},"flatOptions":{"context":true,"url":true},"jsonp":"callback","dataTypes":["text"],"crossDomain":false,"hasContent":false} GlobalErrorHandler.js:14<http://localhost:8080/instihire/assets/6.0.0.1376577187577/ctx/js/GlobalErrorHandler.js>
exception: ""

I'm going to try to remove the ActivationContext and see if that fixes these problems.  I really don't know what else to do at this point.


________________________________
Since 1982, Starpoint Solutions has been a trusted source of human capital and solutions. We are committed to our clients, employees, environment, community and social concerns. We foster an inclusive culture based on trust, respect, honesty and solid performance. Learn more about Starpoint and our social responsibility at http://www.starpoint.com/social_responsibility

________________________________
This email message from Starpoint Solutions LLC is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. Opinions, conclusions and other information in this message that do not relate to the official business of Starpoint Solutions shall be understood as neither given nor endorsed by it.

Re: ActivationContext messing up more AJAX calls

Posted by Tony Nelson <tn...@starpoint.com>.
On Aug 15, 2013, at 12:51 PM, Thiago H de Paula Figueiredo <th...@gmail.com> wrote:

> Your Java code looks ok. Could you please post your JavaScript code that
> is invoked by the addInitializerCall() call? It may be choking on the
> query string.
>

Sorry I forgot it.

(function ($) {

    T5.extendInitializers(function () {

        function init(specs) {
            $(document).everyTime(specs.timeout, function () {
                $.get(specs.url)
                    .done(function (data) {
                        $('#alertCount').html(data.alertCount);
                    });
            });
        }

        return {
            alertCount: init
        }

    });

})(jQuery);



Since 1982, Starpoint Solutions has been a trusted source of human capital and solutions. We are committed to our clients, employees, environment, community and social concerns.  We foster an inclusive culture based on trust, respect, honesty and solid performance. Learn more about Starpoint and our social responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the intended recipient(s) and may contain confidential and privileged  information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.  Opinions, conclusions and other information in this message that do not relate to the official business of Starpoint Solutions shall be understood as neither given nor endorsed by it.

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


Re: ActivationContext messing up more AJAX calls

Posted by Tony Nelson <tn...@starpoint.com>.
On Aug 15, 2013, at 12:51 PM, Thiago H de Paula Figueiredo <th...@gmail.com> wrote:

> Your Java code looks ok. Could you please post your JavaScript code that
> is invoked by the addInitializerCall() call? It may be choking on the
> query string.
>

I don't want to waste anyones time.  Removing @PageActivationContext and creating on onActivate seems to have solved everything.

The urls generated by ComponentResources no longer contain the Id of the main page object.  Probably because I didn't' create an onPassivate, but I'll cross that bridge if/when I need to.

Thanks
Tony


Since 1982, Starpoint Solutions has been a trusted source of human capital and solutions. We are committed to our clients, employees, environment, community and social concerns.  We foster an inclusive culture based on trust, respect, honesty and solid performance. Learn more about Starpoint and our social responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the intended recipient(s) and may contain confidential and privileged  information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.  Opinions, conclusions and other information in this message that do not relate to the official business of Starpoint Solutions shall be understood as neither given nor endorsed by it.

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


Re: ActivationContext messing up more AJAX calls

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
Your Java code looks ok. Could you please post your JavaScript code that  
is invoked by the addInitializerCall() call? It may be choking on the  
query string.

-- 
Thiago H. de Paula Figueiredo

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