更新时间:2023-12-03 11:04:34
为什么它可以在 PhoneGap 中运行,而不能在 Java 中运行.PhoneGap 在 Web 容器中运行该应用程序,因此已经通过身份验证 - 您拥有所有正确的 cookie.AJAX 将共享同一个会话,一切都正常工作".
How come it works from the PhoneGap but not Java. PhoneGap runs the app in a web container and so already has been authenticated - and you have all the right cookies. AJAX will share the same session that and everything 'just works'.
然而,HTTPClient 是完全不同的 - 您正在启动一个全新的 HTTP 会话,并且一切都必须正确.
However HTTPClient is a completely different - you are initiating a brand new HTTP session and everything has to be right.
关于 HTTP 身份验证如何工作的一些评论:
A few comments on how HTTP Auth works:
有多种 HTTP 身份验证方法 - 由网络服务器选择.在继续之前,请检查您的 Drupal 配置以确定它是否是:
There are several HTTP authentication methods - and it's the web server that chooses which. Before going any further, check your Drupal configuration to work out whether it is:
(还要注意,Web 容器具有智能"功能,可以根据服务器的要求尝试不同的身份验证方法,所有这些都在幕后进行)
(Note also that the web container has the 'smarts' to be able to try different authentication methods as requested by the server, all behind the scenes)
还要检查 Drupal 网络日志.几点说明:
Also check the Drupal web logs. A few pointers:
如果这有帮助,请告诉我.如果没有,您可以根据这篇文章提供更多详细信息,我可以跟进提供更多建议.
Let me know if this helps. If not, and you can give more details as per this post, I can follow up with more advice.