为什么运行多个 Wicket 应用程序会导致 AJAX 冲突?

发布于 2024-10-31 19:43:22 字数 914 浏览 2 评论 0原文

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

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

也许这与后备功能有关。

当仅打开一个 Web 应用程序时,它可以正常运行。

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

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 请求将在其标头中获取以下行:

[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.

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

Perhaps it is something related to the fallback function.

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, line 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
}

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: .]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初雪 2024-11-07 19:43:22

您能否检查您的应用程序的根上下文是否不同?否则,您可能会在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文