玩! 2.0简单的办法,为路由器包罗万象的响应中?

编程入门 行业动态 更新时间:2024-10-10 01:27:33
本文介绍了玩! 2.0简单的办法,为路由器包罗万象的响应中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有做一些恼人的问题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简单的办法,为路由器包罗万象的响应中?

本文发布于:2023-11-28 08:48:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:包罗万象   路由器   办法   简单

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!