You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2011/09/28 11:22:04 UTC

Re: adding resources after ajax swap

Actually it seems Wicket is to blame here.
In wicket-ajax.js, line 1680 (processScript() method) there is the
following line:
var req = new Wicket.Ajax.Request(src, onLoad, false, false);
where src is the src attribute of the contributed script element.

Why Wicket tries to load the script body with Ajax and add it as
<script> body here </script> to the <head> ?
It seems to be much more simpler just to add the contributed <script
src="..."> to the <head>.

On Thu, Sep 22, 2011 at 11:23 PM, Pointbreak
<po...@ml1.net> wrote:
> Of course you could also just load the scripts in your page instead of
> via ajax... just my 2cnts.
>
> On Thursday, September 22, 2011 3:18 PM, "Steve Lowery"
> <sl...@gatessolutions.com> wrote:
>> Is that a filter on my end?  Would that go before or after my wicket
>> filter
>> mapping?  Any helpful resources out there on this?  I haven't dealt with
>> OPTIONS methods before.
>>
>>
>> On Thu, Sep 22, 2011 at 2:28 PM, Steve Lowery
>> <sl...@gatessolutions.com>wrote:
>>
>> > I'm having an issue using resources after an ajax swap, in this case
>> > jquery.  My home page does not have anything jquery related on it.  There is
>> > an AjaxFallbackLink which swaps out the main content.  The new content Panel
>> > has a jquery header contributor.  I see this is being returned in the
>> > response to the AjaxFallbackLink click:
>> >
>> > <ajax-response><header-contribution encoding="wicket1" ><![CDATA[<head
>> > xmlns:wicket="http://wicket.apache.org"><script type="text/javascript" src
>> > ="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
>> > </script>...
>> > </ajax-response>
>> >
>> > However, I notice that the browser is attempting to retrieve the jquery
>> > resource via the OPTIONS method.  It does not appear to be getting added to
>> > the head and therefore, my component fails because it tries to do some
>> > jQuery stuff but it isn't available.
>> >
>> > Is this the expected behavior or am I doing something wrong?  Do I have to
>> > load 3rd party libraries on the Page or register headerListener with the
>> > application?  I have seen the same behavior with other javascript libraries
>> > (i.e. yui).
>> >
>> >
>> >
>> >
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Re: adding resources after ajax swap

Posted by Igor Vaynberg <ig...@gmail.com>.
hrm. that seems pretty strange. might have had something to do with
WICKET-1623. something we should fix though...

-igor


On Wed, Sep 28, 2011 at 2:22 AM, Martin Grigorov <mg...@apache.org> wrote:
> Actually it seems Wicket is to blame here.
> In wicket-ajax.js, line 1680 (processScript() method) there is the
> following line:
> var req = new Wicket.Ajax.Request(src, onLoad, false, false);
> where src is the src attribute of the contributed script element.
>
> Why Wicket tries to load the script body with Ajax and add it as
> <script> body here </script> to the <head> ?
> It seems to be much more simpler just to add the contributed <script
> src="..."> to the <head>.
>
> On Thu, Sep 22, 2011 at 11:23 PM, Pointbreak
> <po...@ml1.net> wrote:
>> Of course you could also just load the scripts in your page instead of
>> via ajax... just my 2cnts.
>>
>> On Thursday, September 22, 2011 3:18 PM, "Steve Lowery"
>> <sl...@gatessolutions.com> wrote:
>>> Is that a filter on my end?  Would that go before or after my wicket
>>> filter
>>> mapping?  Any helpful resources out there on this?  I haven't dealt with
>>> OPTIONS methods before.
>>>
>>>
>>> On Thu, Sep 22, 2011 at 2:28 PM, Steve Lowery
>>> <sl...@gatessolutions.com>wrote:
>>>
>>> > I'm having an issue using resources after an ajax swap, in this case
>>> > jquery.  My home page does not have anything jquery related on it.  There is
>>> > an AjaxFallbackLink which swaps out the main content.  The new content Panel
>>> > has a jquery header contributor.  I see this is being returned in the
>>> > response to the AjaxFallbackLink click:
>>> >
>>> > <ajax-response><header-contribution encoding="wicket1" ><![CDATA[<head
>>> > xmlns:wicket="http://wicket.apache.org"><script type="text/javascript" src
>>> > ="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
>>> > </script>...
>>> > </ajax-response>
>>> >
>>> > However, I notice that the browser is attempting to retrieve the jquery
>>> > resource via the OPTIONS method.  It does not appear to be getting added to
>>> > the head and therefore, my component fails because it tries to do some
>>> > jQuery stuff but it isn't available.
>>> >
>>> > Is this the expected behavior or am I doing something wrong?  Do I have to
>>> > load 3rd party libraries on the Page or register headerListener with the
>>> > application?  I have seen the same behavior with other javascript libraries
>>> > (i.e. yui).
>>> >
>>> >
>>> >
>>> >
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: adding resources after ajax swap

Posted by Igor Vaynberg <ig...@gmail.com>.
hrm. that seems pretty strange. might have had something to do with
WICKET-1623. something we should fix though...

-igor


On Wed, Sep 28, 2011 at 2:22 AM, Martin Grigorov <mg...@apache.org> wrote:
> Actually it seems Wicket is to blame here.
> In wicket-ajax.js, line 1680 (processScript() method) there is the
> following line:
> var req = new Wicket.Ajax.Request(src, onLoad, false, false);
> where src is the src attribute of the contributed script element.
>
> Why Wicket tries to load the script body with Ajax and add it as
> <script> body here </script> to the <head> ?
> It seems to be much more simpler just to add the contributed <script
> src="..."> to the <head>.
>
> On Thu, Sep 22, 2011 at 11:23 PM, Pointbreak
> <po...@ml1.net> wrote:
>> Of course you could also just load the scripts in your page instead of
>> via ajax... just my 2cnts.
>>
>> On Thursday, September 22, 2011 3:18 PM, "Steve Lowery"
>> <sl...@gatessolutions.com> wrote:
>>> Is that a filter on my end?  Would that go before or after my wicket
>>> filter
>>> mapping?  Any helpful resources out there on this?  I haven't dealt with
>>> OPTIONS methods before.
>>>
>>>
>>> On Thu, Sep 22, 2011 at 2:28 PM, Steve Lowery
>>> <sl...@gatessolutions.com>wrote:
>>>
>>> > I'm having an issue using resources after an ajax swap, in this case
>>> > jquery.  My home page does not have anything jquery related on it.  There is
>>> > an AjaxFallbackLink which swaps out the main content.  The new content Panel
>>> > has a jquery header contributor.  I see this is being returned in the
>>> > response to the AjaxFallbackLink click:
>>> >
>>> > <ajax-response><header-contribution encoding="wicket1" ><![CDATA[<head
>>> > xmlns:wicket="http://wicket.apache.org"><script type="text/javascript" src
>>> > ="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
>>> > </script>...
>>> > </ajax-response>
>>> >
>>> > However, I notice that the browser is attempting to retrieve the jquery
>>> > resource via the OPTIONS method.  It does not appear to be getting added to
>>> > the head and therefore, my component fails because it tries to do some
>>> > jQuery stuff but it isn't available.
>>> >
>>> > Is this the expected behavior or am I doing something wrong?  Do I have to
>>> > load 3rd party libraries on the Page or register headerListener with the
>>> > application?  I have seen the same behavior with other javascript libraries
>>> > (i.e. yui).
>>> >
>>> >
>>> >
>>> >
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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