You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Arie Fishler <ar...@gmail.com> on 2010/04/21 08:11:45 UTC

AbstractDefaultAjaxBehavior - getCallBackUrl

Hello,

I am extending AbstractDefaultAjaxBehavior and using getCallBackUrl to place
the ajax call in a JS function.

This works fine.

The only problem I have is that the getCallBackUrl does not seem to take
into account the container's (tomcat) behavior of adding the JSESSIONID
within the URL in case cookies are not enabled on the client browser.

The JSESSIONID is added fine for other URLs within my app but when using
getCallBackUrl and cookies are not enabled - the ajax call results in "page
expired".

Is there a way that getCallBackUrl handles that right?

Arie

Re: AbstractDefaultAjaxBehavior - getCallBackUrl

Posted by Arie Fishler <ar...@gmail.com>.
I don't get the difference - Wicket's ajax calls work just fine - they are
all on the page with the wicketAjaxGet() function - the first parameter
which is the URL has the jsessionid

when I generate my JS function which is only used to call the ajax
*

function* myFunction(){

*var* wcall=wicketAjaxGet('${ajaxCallUrl}' , *function*() { }, *function*()
{ });

}

I generate the ajaxCallUrl with getCallbackUrl(*true*) of the behavior

The result is something like

?wicket:interface=:0:homePagePanel:promotionsPanel::IActivePageBehaviorListener:10:&wicket:ignoreIfNotActive=true

With no jsessionid when actually required (cookies not enabled on the client
browser)

The full code of the behavior's onBind that does it

@Override

*protected* *void* onBind() {

Component comp = getComponent();

markupId = comp.getMarkupId();

Map<String, Object> scriptParams = *new* HashMap<String, Object>();

scriptParams.put("ajaxCallUrl", getCallbackUrl(*true*).toString());

scriptParams.put("functionName", getGeneratedFunctionName());

*if* (paramName == *null*)

getComponent().add(*new* ScriptHeaderContributor(AjaxJSFunctionBehavior.*
class*, "ajaxfunction.js", scriptParams));

*else* {

scriptParams.put("paramName", paramName);

getComponent().add(*new* ScriptHeaderContributor(AjaxJSFunctionBehavior.*
class*, "ajaxParamFunction.js", scriptParams));

}

*super*.onBind();

}

On Wed, Apr 21, 2010 at 9:11 AM, Arie Fishler <ar...@gmail.com> wrote:

>  Hello,
>
> I am extending AbstractDefaultAjaxBehavior and using getCallBackUrl to
> place the ajax call in a JS function.
>
> This works fine.
>
> The only problem I have is that the getCallBackUrl does not seem to take
> into account the container's (tomcat) behavior of adding the JSESSIONID
> within the URL in case cookies are not enabled on the client browser.
>
> The JSESSIONID is added fine for other URLs within my app but when using
> getCallBackUrl and cookies are not enabled - the ajax call results in "page
> expired".
>
> Is there a way that getCallBackUrl handles that right?
>
> Arie
>