为什么运行多个Wicket应用程序会导致AJAX冲突? [英] Why does running multiple Wicket applications cause AJAX conflicts?

查看:80
本文介绍了为什么运行多个Wicket应用程序会导致AJAX冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在同一浏览器中打开两个Wicket Web应用程序时,似乎出现了AJAX冲突,因为我看到了整页刷新而不是部分刷新。即使应用程序位于不同的服务器和端口号上也是如此。

When I open two Wicket web applications in the same browser, it seems there are AJAX conflicts as I see a full page refresh in place of a partial refresh. This is true even if the applications are on different servers and port numbers.

我只使用Wicket提供的现成JavaScript( tabbedPanel onTimerAutoRefresh )。

I only use the out-of-the-box JavaScript provided by Wicket (tabbedPanel, onTimerAutoRefresh).

也许与回退有关功能。

仅打开一个Web应用程序时,它可以正常工作。

When only one web application is open, it works without any problems.

我没有在示例网站上有问题,因此我认为我的应用程序的配置有问题。

I don't have a problem on the examples site, so I think something is wrong with the configuration of my application.

wicket-ajax.js ,第970行:

try {
    redirectUrl = t.getResponseHeader('Ajax-Location');
} catch (ignore) { // might happen in older mozilla
}

// the redirect header was set, go to new url
if (typeof(redirectUrl) != "undefined" &&
    redirectUrl != null &&
    redirectUrl != "") {
    //redirect and do a full page refresh (window.location = redirectUrl);
}else{
    // do the normal ajax functionality
}

一切正常时,标头中没有Ajax-Location。当第二个Web应用程序在同一浏览器中加载时,第一个加载的Web应用程序上的下一个AJAX请求将在其标头中获得以下行:

When everything is okay, there is no Ajax-Location in the header. When the second web application is loaded in the same browser, then the next AJAX request on the first loaded web application gets this line in its header:


[Ajax-Location:。]


推荐答案

可以检查应用程序的根上下文是否不同吗?否则,您可能会在Cookie级别发生冲突。它们根据主机名和路径进行存储。如果两个应用程序的上下文路径均为 /,则cookie值将被覆盖。发生冲突的地方。

Can you check that the root context of your applications is different? Otherwise, you could have a conflict at cookie level. They are stored based on the hostname and the path. If the context path of both application is "/", then the cookie values will be overwritten. Whence the conflict that you see.

这篇关于为什么运行多个Wicket应用程序会导致AJAX冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆