You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Stefan Lindner <li...@visionet.de> on 2009/06/06 20:34:15 UTC

Ajax URL encoding and &

In current wicket 1.4 trunk a call to

     AbstractAjaxBehavior.getCallbackUrl

Returns something like

 
wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
ener:1:&wicket:ignoreIfNotActive=true'); };

The Firefox html validator plugins don't accept this as correct urls.
They tell me

     "cannot generate system identifier for general enttiy
wicket:ignoreIfNotActive"

And tell me to replace the "&" by "&amp;" but this breaks
wicketAjaxGet's functionality.
Is there any trick to get this fixed (besides the option not to use
strict html).

Stefan.

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


RE: Ajax URL encoding and &

Posted by Stefan Lindner <li...@visionet.de>.
Ah! Thank you! That's it!

-----Ursprüngliche Nachricht-----
Von: Johan Compagner [mailto:jcompagner@gmail.com] 
Gesendet: Sonntag, 7. Juni 2009 12:27
An: users@wicket.apache.org
Betreff: Re: Ajax URL encoding and &

ahh you write javascript yourself.

use:
 use JavascriptUtils.writeJavascript(*final* Response response,
*final*CharSequence text, String id) for that
That will make sure that the javascript is property escaped between CDATA



On Sun, Jun 7, 2009 at 01:51, Stefan Lindner <li...@visionet.de> wrote:

> I want to trigger a method of a wicket component from  a self written
> JavaScript function e.g.
>
>     <script>
>          onClick....call 'WicketAjax
>     </script>
>
> So I create an AjaxBehavior that extends AbstractAjaxBehavior oder
> AbstractDefaultAjaxBehavior and add it to a Wicket Component.
>
> My class implements the onComponentRendered method jut like this
>
>     String func = "function() { wicketAjaxGet('" + this.getCallbackUrl() +
> "'); }"
>
>     RequestCycle tequestCycle = RequestCycle.get();
>
>     Response response = tequestCycle.getResponse();
>
>     response.write(builder.toScriptTag());
>
> And because getCallbackUrl does not escape the & the raw & is rendered into
> the page. This is nor problem for functionality (everything works well) but
> it makes html debugging hard because of the validation errors caused by &.
>
> Now I can do the encodeing by myself but then the wicketAjaxGet fires the
> respond method wit all parameters named "&amp;paramName".
>
> Now I can call
>
>     getComponent().getRequest().getParameter("&amp;paramName")
>
> in the respond method but this looks strange for me.
>
> If this is the intended way to do such things I will do them so.
>
>
> ________________________________
>
> Von: Johan Compagner [mailto:jcompagner@gmail.com]
> Gesendet: So 07.06.2009 00:25
>  An: users@wicket.apache.org
> Betreff: Re: Ajax URL encoding and &
>
>
>
> ahh yes it is the ajax event behavior that is altered
> (thats an behavior that is attached to events so on attributes like
> onclick)
>
> which behavior do you exactly use and where is it exactly inserted in?
>
> On Sun, Jun 7, 2009 at 00:13, Stefan Lindner <li...@visionet.de> wrote:
>
> > Looking into current trunk (1.4):
> > The only Class that extends AbstractAjaxBrhavior is
> > AbstractDefaultAjaxBehavior. In both classes the onComponentTag method
> does
> > nothingI should overwrite the onComponentTag method and escape all & to
> > &amp;?
> > But when I do this, the ajax callback no longer works.
> >
> > ________________________________
> >
> > Von: Johan Compagner [mailto:jcompagner@gmail.com]
> > Gesendet: Sa 06.06.2009 23:28
> > An: users@wicket.apache.org
> > Betreff: Re: Ajax URL encoding and &
> >
> >
> >
> > This should be fixed in the current trunk i think
> >
> > yes getCallbackUrl doesnt escape the markup yet
> > But the onComponentTag of the AjaxBehaviors should escape it right before
> > it
> > gets inserted into the attributes markup.
> >
> >
> >
> > On Sat, Jun 6, 2009 at 20:34, Stefan Lindner <li...@visionet.de>
> wrote:
> >
> > > In current wicket 1.4 trunk a call to
> > >
> > >     AbstractAjaxBehavior.getCallbackUrl
> > >
> > > Returns something like
> > >
> > >
> > >
> wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
> > > ener:1:&wicket:ignoreIfNotActive=true'); };
> > >
> > > The Firefox html validator plugins don't accept this as correct urls.
> > > They tell me
> > >
> > >     "cannot generate system identifier for general enttiy
> > > wicket:ignoreIfNotActive"
> > >
> > > And tell me to replace the "&" by "&amp;" but this breaks
> > > wicketAjaxGet's functionality.
> > > Is there any trick to get this fixed (besides the option not to use
> > > strict html).
> > >
> > > Stefan.
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
>
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Ajax URL encoding and &

Posted by Johan Compagner <jc...@gmail.com>.
ahh you write javascript yourself.

use:
 use JavascriptUtils.writeJavascript(*final* Response response,
*final*CharSequence text, String id) for that
That will make sure that the javascript is property escaped between CDATA



On Sun, Jun 7, 2009 at 01:51, Stefan Lindner <li...@visionet.de> wrote:

> I want to trigger a method of a wicket component from  a self written
> JavaScript function e.g.
>
>     <script>
>          onClick....call 'WicketAjax
>     </script>
>
> So I create an AjaxBehavior that extends AbstractAjaxBehavior oder
> AbstractDefaultAjaxBehavior and add it to a Wicket Component.
>
> My class implements the onComponentRendered method jut like this
>
>     String func = "function() { wicketAjaxGet('" + this.getCallbackUrl() +
> "'); }"
>
>     RequestCycle tequestCycle = RequestCycle.get();
>
>     Response response = tequestCycle.getResponse();
>
>     response.write(builder.toScriptTag());
>
> And because getCallbackUrl does not escape the & the raw & is rendered into
> the page. This is nor problem for functionality (everything works well) but
> it makes html debugging hard because of the validation errors caused by &.
>
> Now I can do the encodeing by myself but then the wicketAjaxGet fires the
> respond method wit all parameters named "&amp;paramName".
>
> Now I can call
>
>     getComponent().getRequest().getParameter("&amp;paramName")
>
> in the respond method but this looks strange for me.
>
> If this is the intended way to do such things I will do them so.
>
>
> ________________________________
>
> Von: Johan Compagner [mailto:jcompagner@gmail.com]
> Gesendet: So 07.06.2009 00:25
>  An: users@wicket.apache.org
> Betreff: Re: Ajax URL encoding and &
>
>
>
> ahh yes it is the ajax event behavior that is altered
> (thats an behavior that is attached to events so on attributes like
> onclick)
>
> which behavior do you exactly use and where is it exactly inserted in?
>
> On Sun, Jun 7, 2009 at 00:13, Stefan Lindner <li...@visionet.de> wrote:
>
> > Looking into current trunk (1.4):
> > The only Class that extends AbstractAjaxBrhavior is
> > AbstractDefaultAjaxBehavior. In both classes the onComponentTag method
> does
> > nothingI should overwrite the onComponentTag method and escape all & to
> > &amp;?
> > But when I do this, the ajax callback no longer works.
> >
> > ________________________________
> >
> > Von: Johan Compagner [mailto:jcompagner@gmail.com]
> > Gesendet: Sa 06.06.2009 23:28
> > An: users@wicket.apache.org
> > Betreff: Re: Ajax URL encoding and &
> >
> >
> >
> > This should be fixed in the current trunk i think
> >
> > yes getCallbackUrl doesnt escape the markup yet
> > But the onComponentTag of the AjaxBehaviors should escape it right before
> > it
> > gets inserted into the attributes markup.
> >
> >
> >
> > On Sat, Jun 6, 2009 at 20:34, Stefan Lindner <li...@visionet.de>
> wrote:
> >
> > > In current wicket 1.4 trunk a call to
> > >
> > >     AbstractAjaxBehavior.getCallbackUrl
> > >
> > > Returns something like
> > >
> > >
> > >
> wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
> > > ener:1:&wicket:ignoreIfNotActive=true'); };
> > >
> > > The Firefox html validator plugins don't accept this as correct urls.
> > > They tell me
> > >
> > >     "cannot generate system identifier for general enttiy
> > > wicket:ignoreIfNotActive"
> > >
> > > And tell me to replace the "&" by "&amp;" but this breaks
> > > wicketAjaxGet's functionality.
> > > Is there any trick to get this fixed (besides the option not to use
> > > strict html).
> > >
> > > Stefan.
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

Re: Custom HeaderContributor

Posted by Igor Vaynberg <ig...@gmail.com>.
if there is no factory add a jira to create one. this might, however,
be tricky because we use different instances for regular requests and
ajax requests because they have to do different things - so i do not
know how feasible a factory is or if we have to create both or what.

-igor

On Sun, Jun 7, 2009 at 10:15 PM, Stefan Lindner<li...@visionet.de> wrote:
> Hello Jeremy,
>
> you wrote "HeaderContributor is rather an implementation of IHeaderContributor - of which of course you could create your own implementations"
>
> Great to read, but how can I do this?
>
> -----Ursprüngliche Nachricht-----
> Von: Jeremy Thomerson [mailto:jeremy@wickettraining.com]
> Gesendet: Montag, 8. Juni 2009 02:22
> An: users@wicket.apache.org
> Betreff: Re: Custom HeaderContributor
>
> HeaderContributor is rather an implementation of IHeaderContributor -
> of which of course you could create your own implementations.  What
> you really seem to be seeking is to make each ajax behavior use a
> different header contributor.  For that, you would need to override
> the way which each ajax behavior contributes script.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Sun, Jun 7, 2009 at 12:25 PM, Stefan Lindner <li...@visionet.de> wrote:
>> OK :-)
>> When I create a special AjaxBehavior I can overwrite the onRenderHead method which has an IHeaderContributor (=Header Contributor) as parameterJavaScript to the page's <head> section.
>> But every AjaxBehavior renders it's own <script>....</script> tag. I there are a lot of such AjaxBehaviors on a page then the header contains a huge number of <script>...</script> sections with only a few characters of javascript inside.
>> I found no possibility to combine all the small pieces in one <script>....</script> section.
>> So my idea was to use my own, extended version of HeaderContributor. Just like I can have a own version of Session. But where can I direct Wicket to use my extended version of HeaderContributor?
>>
>> ________________________________
>>
>> Von: Martin Funk [mailto:mafulafunk@googlemail.com]
>> Gesendet: So 07.06.2009 19:00
>> An: users@wicket.apache.org
>> Betreff: Re: Custom HeaderContributor
>>
>>
>>
>>
>> Am 07.06.2009 um 18:43 schrieb Stefan Lindner:
>>
>>> Is it possible to have a custom HeaderContributor?
>>
>> err... could you elaborate a little more?
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
> ---------------------------------------------------------------------
> 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


Re: AW: Custom HeaderContributor

Posted by Martin Funk <ma...@googlemail.com>.
Hi Stefan,

I can see the pain you have with the  <script>...</script> sections.
But looking at HeaderResponse#renderJavascript(..) I'd say wicket  
might not be very helpful in aggregating all the script sections into  
one.
My best shot would be trying to aggregate the Behaviors into one/fewer  
Behaviors.

But you could always create a jira or put something on the 1.5  
wishlist :-)

mf

Am 08.06.2009 um 07:15 schrieb Stefan Lindner:

> Hello Jeremy,
>
> you wrote "HeaderContributor is rather an implementation of  
> IHeaderContributor - of which of course you could create your own  
> implementations"
>
> Great to read, but how can I do this?
>
> -----Ursprüngliche Nachricht-----
> Von: Jeremy Thomerson [mailto:jeremy@wickettraining.com]
> Gesendet: Montag, 8. Juni 2009 02:22
> An: users@wicket.apache.org
> Betreff: Re: Custom HeaderContributor
>
> HeaderContributor is rather an implementation of IHeaderContributor -
> of which of course you could create your own implementations.  What
> you really seem to be seeking is to make each ajax behavior use a
> different header contributor.  For that, you would need to override
> the way which each ajax behavior contributes script.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Sun, Jun 7, 2009 at 12:25 PM, Stefan Lindner  
> <li...@visionet.de> wrote:
>> OK :-)
>> When I create a special AjaxBehavior I can overwrite the  
>> onRenderHead method which has an IHeaderContributor (=Header  
>> Contributor) as parameterJavaScript to the page's <head> section.
>> But every AjaxBehavior renders it's own <script>....</script> tag.  
>> I there are a lot of such AjaxBehaviors on a page then the header  
>> contains a huge number of <script>...</script> sections with only a  
>> few characters of javascript inside.
>> I found no possibility to combine all the small pieces in one  
>> <script>....</script> section.
>> So my idea was to use my own, extended version of  
>> HeaderContributor. Just like I can have a own version of Session.  
>> But where can I direct Wicket to use my extended version of  
>> HeaderContributor?
>>
>> ________________________________
>>
>> Von: Martin Funk [mailto:mafulafunk@googlemail.com]
>> Gesendet: So 07.06.2009 19:00
>> An: users@wicket.apache.org
>> Betreff: Re: Custom HeaderContributor
>>
>>
>>
>>
>> Am 07.06.2009 um 18:43 schrieb Stefan Lindner:
>>
>>> Is it possible to have a custom HeaderContributor?
>>
>> err... could you elaborate a little more?
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
> ---------------------------------------------------------------------
> 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


AW: Custom HeaderContributor

Posted by Stefan Lindner <li...@visionet.de>.
Hello Jeremy,

you wrote "HeaderContributor is rather an implementation of IHeaderContributor - of which of course you could create your own implementations"

Great to read, but how can I do this?

-----Ursprüngliche Nachricht-----
Von: Jeremy Thomerson [mailto:jeremy@wickettraining.com] 
Gesendet: Montag, 8. Juni 2009 02:22
An: users@wicket.apache.org
Betreff: Re: Custom HeaderContributor

HeaderContributor is rather an implementation of IHeaderContributor -
of which of course you could create your own implementations.  What
you really seem to be seeking is to make each ajax behavior use a
different header contributor.  For that, you would need to override
the way which each ajax behavior contributes script.

--
Jeremy Thomerson
http://www.wickettraining.com




On Sun, Jun 7, 2009 at 12:25 PM, Stefan Lindner <li...@visionet.de> wrote:
> OK :-)
> When I create a special AjaxBehavior I can overwrite the onRenderHead method which has an IHeaderContributor (=Header Contributor) as parameterJavaScript to the page's <head> section.
> But every AjaxBehavior renders it's own <script>....</script> tag. I there are a lot of such AjaxBehaviors on a page then the header contains a huge number of <script>...</script> sections with only a few characters of javascript inside.
> I found no possibility to combine all the small pieces in one <script>....</script> section.
> So my idea was to use my own, extended version of HeaderContributor. Just like I can have a own version of Session. But where can I direct Wicket to use my extended version of HeaderContributor?
>
> ________________________________
>
> Von: Martin Funk [mailto:mafulafunk@googlemail.com]
> Gesendet: So 07.06.2009 19:00
> An: users@wicket.apache.org
> Betreff: Re: Custom HeaderContributor
>
>
>
>
> Am 07.06.2009 um 18:43 schrieb Stefan Lindner:
>
>> Is it possible to have a custom HeaderContributor?
>
> err... could you elaborate a little more?
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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


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


Re: Custom HeaderContributor

Posted by Jeremy Thomerson <je...@wickettraining.com>.
HeaderContributor is rather an implementation of IHeaderContributor -
of which of course you could create your own implementations.  What
you really seem to be seeking is to make each ajax behavior use a
different header contributor.  For that, you would need to override
the way which each ajax behavior contributes script.

--
Jeremy Thomerson
http://www.wickettraining.com




On Sun, Jun 7, 2009 at 12:25 PM, Stefan Lindner <li...@visionet.de> wrote:
> OK :-)
> When I create a special AjaxBehavior I can overwrite the onRenderHead method which has an IHeaderContributor (=Header Contributor) as parameterJavaScript to the page's <head> section.
> But every AjaxBehavior renders it's own <script>....</script> tag. I there are a lot of such AjaxBehaviors on a page then the header contains a huge number of <script>...</script> sections with only a few characters of javascript inside.
> I found no possibility to combine all the small pieces in one <script>....</script> section.
> So my idea was to use my own, extended version of HeaderContributor. Just like I can have a own version of Session. But where can I direct Wicket to use my extended version of HeaderContributor?
>
> ________________________________
>
> Von: Martin Funk [mailto:mafulafunk@googlemail.com]
> Gesendet: So 07.06.2009 19:00
> An: users@wicket.apache.org
> Betreff: Re: Custom HeaderContributor
>
>
>
>
> Am 07.06.2009 um 18:43 schrieb Stefan Lindner:
>
>> Is it possible to have a custom HeaderContributor?
>
> err... could you elaborate a little more?
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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


RE: Custom HeaderContributor

Posted by Stefan Lindner <li...@visionet.de>.
OK :-)
When I create a special AjaxBehavior I can overwrite the onRenderHead method which has an IHeaderContributor (=Header Contributor) as parameterJavaScript to the page's <head> section.
But every AjaxBehavior renders it's own <script>....</script> tag. I there are a lot of such AjaxBehaviors on a page then the header contains a huge number of <script>...</script> sections with only a few characters of javascript inside.
I found no possibility to combine all the small pieces in one <script>....</script> section.
So my idea was to use my own, extended version of HeaderContributor. Just like I can have a own version of Session. But where can I direct Wicket to use my extended version of HeaderContributor?

________________________________

Von: Martin Funk [mailto:mafulafunk@googlemail.com]
Gesendet: So 07.06.2009 19:00
An: users@wicket.apache.org
Betreff: Re: Custom HeaderContributor




Am 07.06.2009 um 18:43 schrieb Stefan Lindner:

> Is it possible to have a custom HeaderContributor?

err... could you elaborate a little more?
>
>
>
> ---------------------------------------------------------------------
> 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





Re: Custom HeaderContributor

Posted by Martin Funk <ma...@googlemail.com>.
Am 07.06.2009 um 18:43 schrieb Stefan Lindner:

> Is it possible to have a custom HeaderContributor?

err... could you elaborate a little more?
>
>
>
> ---------------------------------------------------------------------
> 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


Custom HeaderContributor

Posted by Stefan Lindner <li...@visionet.de>.
Is it possible to have a custom HeaderContributor?


AW: Ajax URL encoding and &

Posted by Stefan Lindner <li...@visionet.de>.
I want to trigger a method of a wicket component from  a self written JavaScript function e.g.
 
     <script>
          onClick....call 'WicketAjax
     </script>
 
So I create an AjaxBehavior that extends AbstractAjaxBehavior oder AbstractDefaultAjaxBehavior and add it to a Wicket Component.
 
My class implements the onComponentRendered method jut like this 

     String func = "function() { wicketAjaxGet('" + this.getCallbackUrl() + "'); }"

     RequestCycle tequestCycle = RequestCycle.get();

     Response response = tequestCycle.getResponse();

     response.write(builder.toScriptTag());

And because getCallbackUrl does not escape the & the raw & is rendered into the page. This is nor problem for functionality (everything works well) but it makes html debugging hard because of the validation errors caused by &.

Now I can do the encodeing by myself but then the wicketAjaxGet fires the respond method wit all parameters named "&amp;paramName".

Now I can call 

     getComponent().getRequest().getParameter("&amp;paramName")

in the respond method but this looks strange for me.

If this is the intended way to do such things I will do them so.


________________________________

Von: Johan Compagner [mailto:jcompagner@gmail.com]
Gesendet: So 07.06.2009 00:25
An: users@wicket.apache.org
Betreff: Re: Ajax URL encoding and &



ahh yes it is the ajax event behavior that is altered
(thats an behavior that is attached to events so on attributes like onclick)

which behavior do you exactly use and where is it exactly inserted in?

On Sun, Jun 7, 2009 at 00:13, Stefan Lindner <li...@visionet.de> wrote:

> Looking into current trunk (1.4):
> The only Class that extends AbstractAjaxBrhavior is
> AbstractDefaultAjaxBehavior. In both classes the onComponentTag method does
> nothingI should overwrite the onComponentTag method and escape all & to
> &amp;?
> But when I do this, the ajax callback no longer works.
>
> ________________________________
>
> Von: Johan Compagner [mailto:jcompagner@gmail.com]
> Gesendet: Sa 06.06.2009 23:28
> An: users@wicket.apache.org
> Betreff: Re: Ajax URL encoding and &
>
>
>
> This should be fixed in the current trunk i think
>
> yes getCallbackUrl doesnt escape the markup yet
> But the onComponentTag of the AjaxBehaviors should escape it right before
> it
> gets inserted into the attributes markup.
>
>
>
> On Sat, Jun 6, 2009 at 20:34, Stefan Lindner <li...@visionet.de> wrote:
>
> > In current wicket 1.4 trunk a call to
> >
> >     AbstractAjaxBehavior.getCallbackUrl
> >
> > Returns something like
> >
> >
> > wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
> > ener:1:&wicket:ignoreIfNotActive=true'); };
> >
> > The Firefox html validator plugins don't accept this as correct urls.
> > They tell me
> >
> >     "cannot generate system identifier for general enttiy
> > wicket:ignoreIfNotActive"
> >
> > And tell me to replace the "&" by "&amp;" but this breaks
> > wicketAjaxGet's functionality.
> > Is there any trick to get this fixed (besides the option not to use
> > strict html).
> >
> > Stefan.
> >
> > ---------------------------------------------------------------------
> > 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
>




Re: Ajax URL encoding and &

Posted by Johan Compagner <jc...@gmail.com>.
ahh yes it is the ajax event behavior that is altered
(thats an behavior that is attached to events so on attributes like onclick)

which behavior do you exactly use and where is it exactly inserted in?

On Sun, Jun 7, 2009 at 00:13, Stefan Lindner <li...@visionet.de> wrote:

> Looking into current trunk (1.4):
> The only Class that extends AbstractAjaxBrhavior is
> AbstractDefaultAjaxBehavior. In both classes the onComponentTag method does
> nothingI should overwrite the onComponentTag method and escape all & to
> &amp;?
> But when I do this, the ajax callback no longer works.
>
> ________________________________
>
> Von: Johan Compagner [mailto:jcompagner@gmail.com]
> Gesendet: Sa 06.06.2009 23:28
> An: users@wicket.apache.org
> Betreff: Re: Ajax URL encoding and &
>
>
>
> This should be fixed in the current trunk i think
>
> yes getCallbackUrl doesnt escape the markup yet
> But the onComponentTag of the AjaxBehaviors should escape it right before
> it
> gets inserted into the attributes markup.
>
>
>
> On Sat, Jun 6, 2009 at 20:34, Stefan Lindner <li...@visionet.de> wrote:
>
> > In current wicket 1.4 trunk a call to
> >
> >     AbstractAjaxBehavior.getCallbackUrl
> >
> > Returns something like
> >
> >
> > wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
> > ener:1:&wicket:ignoreIfNotActive=true'); };
> >
> > The Firefox html validator plugins don't accept this as correct urls.
> > They tell me
> >
> >     "cannot generate system identifier for general enttiy
> > wicket:ignoreIfNotActive"
> >
> > And tell me to replace the "&" by "&amp;" but this breaks
> > wicketAjaxGet's functionality.
> > Is there any trick to get this fixed (besides the option not to use
> > strict html).
> >
> > Stefan.
> >
> > ---------------------------------------------------------------------
> > 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
>

RE: Ajax URL encoding and &

Posted by Stefan Lindner <li...@visionet.de>.
Looking into current trunk (1.4):
The only Class that extends AbstractAjaxBrhavior is AbstractDefaultAjaxBehavior. In both classes the onComponentTag method does nothingI should overwrite the onComponentTag method and escape all & to &amp;?
But when I do this, the ajax callback no longer works.

________________________________

Von: Johan Compagner [mailto:jcompagner@gmail.com]
Gesendet: Sa 06.06.2009 23:28
An: users@wicket.apache.org
Betreff: Re: Ajax URL encoding and &



This should be fixed in the current trunk i think

yes getCallbackUrl doesnt escape the markup yet
But the onComponentTag of the AjaxBehaviors should escape it right before it
gets inserted into the attributes markup.



On Sat, Jun 6, 2009 at 20:34, Stefan Lindner <li...@visionet.de> wrote:

> In current wicket 1.4 trunk a call to
>
>     AbstractAjaxBehavior.getCallbackUrl
>
> Returns something like
>
>
> wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
> ener:1:&wicket:ignoreIfNotActive=true'); };
>
> The Firefox html validator plugins don't accept this as correct urls.
> They tell me
>
>     "cannot generate system identifier for general enttiy
> wicket:ignoreIfNotActive"
>
> And tell me to replace the "&" by "&amp;" but this breaks
> wicketAjaxGet's functionality.
> Is there any trick to get this fixed (besides the option not to use
> strict html).
>
> Stefan.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>




Re: Ajax URL encoding and &

Posted by Johan Compagner <jc...@gmail.com>.
This should be fixed in the current trunk i think

yes getCallbackUrl doesnt escape the markup yet
But the onComponentTag of the AjaxBehaviors should escape it right before it
gets inserted into the attributes markup.



On Sat, Jun 6, 2009 at 20:34, Stefan Lindner <li...@visionet.de> wrote:

> In current wicket 1.4 trunk a call to
>
>     AbstractAjaxBehavior.getCallbackUrl
>
> Returns something like
>
>
> wicketAjaxGet('?wicket:interface=:0:comp1:comp2::IActivePageBehaviorList
> ener:1:&wicket:ignoreIfNotActive=true'); };
>
> The Firefox html validator plugins don't accept this as correct urls.
> They tell me
>
>     "cannot generate system identifier for general enttiy
> wicket:ignoreIfNotActive"
>
> And tell me to replace the "&" by "&amp;" but this breaks
> wicketAjaxGet's functionality.
> Is there any trick to get this fixed (besides the option not to use
> strict html).
>
> Stefan.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>