将 crossdomain.xml 添加到 tomcat 6.0.24 以使用 Flex 访问 Web 服务
我必须在 Tomcat 6.0.24 上部署一个 Web 应用程序,提供一些应使用 REST 风格的方法访问的 Web 服务(不是完全 REST,因为使用的 Flex 类 HTTPService 只能发送 GET 和 POST)。
Web服务部署在http://localhost:8080/-webappname-/rest/-methodname-
问题是flex沙箱的策略(我认为它是这样称呼的)要求服务器服务必须在其根目录中提供一个文件 crossdomain.xml 。
我创建了包含以下内容的文件:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
现在我必须找到放置它的正确位置,因为我也有一个 apache 服务器在那台机器上运行,端口 80:在
- apache 的 /var/www 中?
http://localhost/
访问 - 可在 tomcat 默认根目录下的 网络应用程序?可访问于
http://localhost:8080/
我正在测试它,它似乎不起作用。也许我做得不对。 PS:我认为 Apache 没有配置为管理 Tomcat 寻址的请求,我认为每个请求都是通过端口调度的。 我无法提供确切的弯曲错误,因为我没有开发该部分。我将尝试在接下来的几个小时内制作一个最小的示例,看看是否可以重现该问题。
I have to deploy a webapp on Tomcat 6.0.24, serving some webservices that should be accessed with REST-style methods (not fully REST, since the used flex class HTTPService can just send GET and POST).
The webservices are deployed at http://localhost:8080/-webappname-/rest/-methodname-
The problem is that the policy of flex sandbox (i think it is called so) requires that the server with the services has to offer a file crossdomain.xml on his root directory.
I created that file with the following contents:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
Now i have to find the right place to put it, since i also have an apache server running on that machine, on port 80:
- in the /var/www of apache?
Accessible athttp://localhost/
- in the ROOT of the tomcat default
webapp? Accessible athttp://localhost:8080/
I am testing it and it does not seem to work. Maybe i am not doing it right.
PS: I think Apache is not configured to manage Tomcat-addressed requests, every request is dispatched by port, i think.
I can not provide the exact flex error since i am not developing that part. I will try to make a minimal example in the next hours and see if i can reproduce the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,只要 URL 请求“http://localhost:8080/crossdomain.xml”返回正确的文件,将其(物理上)粘贴在哪里并不重要。
It actually doesn't matter where you stick it (physically) as long as the URL request "http://localhost:8080/crossdomain.xml" returns the right file.