You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by f a v <fa...@gmail.com> on 2010/12/16 16:19:02 UTC

How to emulate an ajax-response with Wicket?

Hi.

Is there a way to answer an ajax-response XML asked from a Wicket
application from another?
Let me explain, I have an ajax filled DropDownChoice just like the
example one [1], but it's filled from another webapp generating the
ajax-response XML with a JSP.
Now I need to emulate the ajax-response from another Wicket
application and I wanted to use Wicket instead of JSP. I made a Page
that answers the ajax-response XML. The Page works ok when it's
invoked pasting the URL in a browser. But, when the DropDownChoice
invokes the Page it's redirected to the wrong webapp.
In other words, I have a DropDownChoice in webapp A
(http://example.com/a/dropDownPage), a Page that answers an
ajax-response XML in webapp B (http://example.com/b/AjaxResponsePage,
pasting this URL in a browser works) and when /a/dropDownPage asks for
/b/AjaxResponsePage the browser it's redirected to /a/AjaxResponsePage
(note that it's redirected to /a and not /b) and fails.

Debuging I've found that WebRequestCycle.isRedirect() returns true
when WebRequest.isAjax() is true and that triggers a redirect to
AjaxResponsePage (a relative URL, so the browser is changing the base
URL, not Wicket).
Maybe I'm taking the wrong approach and there is a better way to do it
or there is a simple way to bypass this mechanism and make it work.

[1] http://goo.gl/H7jlG

Thanks!

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


Re: How to emulate an ajax-response with Wicket?

Posted by f a v <fa...@gmail.com>.
I've uploaded one to http://db.tt/VX3S5WL

When you change de drop down value, wicketAjaxPost asks for
[/ajaxresponse/localAjaxResponse?random=0.35342031461186707] and
receives:

<ajax-response><redirect><![CDATA[localAjaxResponse/random/0.35342031461186707]]></redirect></ajax-response>

The drop down doesn't change and you are redirected to
[/ajaxresponse/localAjaxResponse/random/0.35342031461186707].
That explains why the browser it's redirected to the wrong webapp when
localAjaxResponse is in another webapp.

I don't know if I should try to change that behavior or look for
another way to do this.

Thank you in advance.

On Thu, Dec 16, 2010 at 9:08 PM, Bruno Borges <br...@gmail.com> wrote:
> Could you provide a wicket quickstart application with such case?
>
>
> Bruno Borges
> www.brunoborges.com.br
> +55 21 76727099
>
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
>  - Francois de La Rochefoucauld

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


Re: How to emulate an ajax-response with Wicket?

Posted by Bruno Borges <br...@gmail.com>.
Could you provide a wicket quickstart application with such case?


Bruno Borges
www.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
 - Francois de La Rochefoucauld



On Thu, Dec 16, 2010 at 1:19 PM, f a v <fa...@gmail.com> wrote:

> Hi.
>
> Is there a way to answer an ajax-response XML asked from a Wicket
> application from another?
> Let me explain, I have an ajax filled DropDownChoice just like the
> example one [1], but it's filled from another webapp generating the
> ajax-response XML with a JSP.
> Now I need to emulate the ajax-response from another Wicket
> application and I wanted to use Wicket instead of JSP. I made a Page
> that answers the ajax-response XML. The Page works ok when it's
> invoked pasting the URL in a browser. But, when the DropDownChoice
> invokes the Page it's redirected to the wrong webapp.
> In other words, I have a DropDownChoice in webapp A
> (http://example.com/a/dropDownPage), a Page that answers an
> ajax-response XML in webapp B (http://example.com/b/AjaxResponsePage,
> pasting this URL in a browser works) and when /a/dropDownPage asks for
> /b/AjaxResponsePage the browser it's redirected to /a/AjaxResponsePage
> (note that it's redirected to /a and not /b) and fails.
>
> Debuging I've found that WebRequestCycle.isRedirect() returns true
> when WebRequest.isAjax() is true and that triggers a redirect to
> AjaxResponsePage (a relative URL, so the browser is changing the base
> URL, not Wicket).
> Maybe I'm taking the wrong approach and there is a better way to do it
> or there is a simple way to bypass this mechanism and make it work.
>
> [1] http://goo.gl/H7jlG
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>