将 clientaccesspolicy.xml 放置在 Netbeans Webservice 项目中的什么位置?

发布于 2024-09-17 18:33:05 字数 615 浏览 7 评论 0原文

我使用 Netbeans 6.9 开发 Web 服务,并使用嵌入式 glassfish 服务器来部署 Web 服务 (http://some_domain/project_name/ws_for_sl4)。在另一台服务器上部署了一个 Silverlight 4 客户端,该客户端应该可以访问 Web 服务。

我知道我必须有 clientaccesspolicy.xml (在 http://some_domain/project_name< /a>)但是我不知道该怎么做。我的意思是,我不知道需要将 clientaccesspolicy.xml 放在 netbeans 项目的哪个文件夹中才能将其自动部署在嵌入式 glassfish 服务器上。让我的 SL4 客户端使用网络服务。

I develop a Webservice using Netbeans 6.9 and I use an embedded glassfish server to deploy my Webservice (http://some_domain/project_name/ws_for_sl4). On a different server there is deployed a Silverlight 4 client, which should have accesss to the Webservice.

I know that I have to have clientaccesspolicy.xml (under http://some_domain/project_name) however I do not know how to do it. I mean, I do not know in which folder of the netbeans project I need to put clientaccesspolicy.xml to have it automaticly deployed on an embedded glassfish server. To have my SL4 client using the webservice.

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

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

发布评论

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

评论(2

烟─花易冷 2024-09-24 18:33:05

解决方案:
- 将 clientaccesspolity.xmlcrossdomain.xml 放在 /Web Pages* 下
- 打开“项目属性”(在项目根目录上单击鼠标右键),转到“运行”,然后删除“上下文路径”的值。

现在,您的 WS 将直接部署在 some_domain 下,因为 SL4 需要它(SL4 正在域名下查找这些文件。)。 SL4 访问 clientaccesspolity.xmlcrossdomain.xml 没有问题。

Solution:
- put clientaccesspolity.xml and crossdomain.xml under /Web Pages*
- open Project Properties (click right mouse button on a project root), go to Run, and delete a value of "Context Path".

Now your WS will be deployed directly under some_domain as it is required by SL4 (SL4 is looking for these files under the domain name.). SL4 will have no problem to access clientaccesspolity.xml and crossdomain.xml.

萌逼全场 2024-09-24 18:33:05

如果有人不喜欢将其 Web 服务移至“root”,而是更喜欢将其放在 http://localhost:8080/aDifferentLocation/MyActualWebService 中,则将这些 XML 放入项目网页中文件夹不会剪切它。

http://localhost:8080/aDifferentLocation/clientaccesspolicy.xml

http://localhost:8080/aDifferentLocation/crossdomain.xml

不起作用,因为它们需要位于

http://localhost:8080/clientaccesspolicy.xml

http://localhost:8080/crossdomain.xml

要实现此目的,您必须找到 GlassFish 服务器的安装文件夹,我们将其命名为 [GlassFishInstallPATH] 并将 XML 粘贴到名为 < 的子文件夹中code>docroot:

[GlassFishInstallPATH]/domains/domain1/docroot/ <--这里是 XML。
(来源)


如果您想知道如何在 Eclipse 中执行相同的操作,您必须找到 Eclipse J2EE 工作区中的 ROOT 文件夹:

C:\Eclipse_j2ee_workspaces\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps \ROOT/ <-- XML 位于此处。

In case anyone doesn't like moving their webservice to "root", and instead prefers to have it in http://localhost:8080/aDifferentLocation/MyActualWebService, then placing those XMLs in the project Web Pages folder doesn't cut it.

http://localhost:8080/aDifferentLocation/clientaccesspolicy.xml
and
http://localhost:8080/aDifferentLocation/crossdomain.xml

would not work, as they need to be in

http://localhost:8080/clientaccesspolicy.xml
and
http://localhost:8080/crossdomain.xml

To achieve this, you must track down the folder where your GlassFish server is installed, let's call it [GlassFishInstallPATH] and paste the XMLs into the subfolder called docroot:

[GlassFishInstallPATH]/domains/domain1/docroot/ <--here go the XMLs.
(source)


In case you're wondering how you would do the same thing in Eclipse, you must track down the ROOT folder in your Eclipse J2EE workspace:

C:\Eclipse_j2ee_workspaces\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT/ <-- the XMLs go here.

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