有做一些恼人的问题AJAX调用仅仅是因为这几天正在一个OPTIONS调用实际AJAX调用之前的服务器。几乎每一个浏览器
Having some annoying issues making AJAX calls simply because almost every browser these days is making an OPTIONS call to the server before the actual AJAX call.
由于我使用的游戏! 2.0,有没有简单的方法使用OPTIONS方法,使一个通配符响应任何路线?
Since I am using Play! 2.0, is there any easy way to make a wildcard response to any route using the OPTIONS method?
例如,在我的路线做这样的事情: 选项/ * controllers.Options.responseDef
For instance, in my routes do something like: OPTIONS /* controllers.Options.responseDef
是的,我知道,新的游戏!没有内置的通配符,但需要有,因为所有的浏览器都日益要求选项之前AJAX调用了一个解决方案。
Yes I am aware that the new Play! doesn't have a wildcard built-in, but there needs to be a solution for this since all browsers are increasingly calling OPTIONS before AJAX calls.
推荐答案不平静了通配符,位可以使用路线横跨几个斜线段
Not quiet a wildcard, bit you can use a route which spans several slash-segments
OPTIONS /*wholepath controllers.Options.responseDef(wholepath) OPTIONS / controllers.Options.responseDef
这应该匹配的所有请求:
It should match all the requests:
OPTIONS /a OPTIONS /a/b OPTIONS /a/b/c请注意:这是从我的头顶,所以也许你需要把它擦亮。我不能由我自己现在检查
Note: that's from the top of my head, so maybe you'll need to polish it. I can't check it now by myself
检查部分动态部分覆盖了手册的若干/
更多推荐
玩! 2.0简单的办法,为路由器包罗万象的响应中?
发布评论