小编Sau*_*gol的帖子

vertx 应用程序中的 CORS 问题不起作用

我的 Vertx 服务器驻留在服务器 A 中,客户端驻留在服务器 B 中。当我尝试访问 vertx 服务器时,出现 CORS 错误。我添加了一些服务器端代码来处理 CORS 问题,但它不起作用。我们是否需要在客户端添加一些标头。我在这里错过了什么?谁能帮忙

顶点服务器端:

Router router = Router.router(vertx);
router.route().handler(BodyHandler.create());
router.route().handler(io.vertx.rxjava.ext.web.handler.CorsHandler.create("*")
.allowedMethod(io.vertx.core.http.HttpMethod.GET)
.allowedMethod(io.vertx.core.http.HttpMethod.POST)
.allowedMethod(io.vertx.core.http.HttpMethod.OPTIONS)
.allowedHeader("Access-Control-Request-Method")
.allowedHeader("Access-Control-Allow-Credentials")
.allowedHeader("Access-Control-Allow-Origin")
.allowedHeader("Access-Control-Allow-Headers")
.allowedHeader("Content-Type"));
Run Code Online (Sandbox Code Playgroud)

客户端实现:

    function(url, user) {
    eventBus = new EventBus(url);
    eventBus.onopen = function() {
            //Do Something
    }
 }
Run Code Online (Sandbox Code Playgroud)

更新:

我删除了标题中的 withCredential 属性。现在我的代码看起来像

if (ar.succeeded()) {
routingContext.response().setStatusCode(200).setStatusMessage("OK")
.putHeader("content-type", "application/json")
.putHeader("Access-Control-Allow-Origin", "*")
.putHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS")
.end(
Json.encodePrettily(ar.result().body())
//(String) ar.result().body()
);
routingContext.response().close(); 
Run Code Online (Sandbox Code Playgroud)

但仍然弹出以下错误。你能帮我吗?

XMLHttpRequest cannot load https://192.168.1.20:7070/Notify/571/rn4nh0r4/xhr_send?t=1471592391921. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header …
Run Code Online (Sandbox Code Playgroud)

javascript java cors vert.x

5
推荐指数
3
解决办法
1万
查看次数

每天,每月和每年重复全日历活动

我想让我的活动每天,每个月和每周重复一次。根据全日历文档,可以在渲染事件时使用陶氏参数每周重复一次事件。因此,我还用它来每天重复以下代码。

 [[id:7718, type:null,
 resourceIds:[13], 
 title:Kas, 
 start:2016-08-10T07:00:00.000+05:45, 
 end:2016-08-10T22:00:00.000+05:45, 
 allDay:false,
 note:dsadsa, 
 member:, 
 dow:[0,1,2,3,4,5,6], 
 ranges:[[start:2016-08-10T07:00:00.000+05:45, end:2021-08-10T07:00:00.000+05:45]],
 ]]
Run Code Online (Sandbox Code Playgroud)

有没有办法让他们每个月和每年重复一次?任何帮助,将不胜感激。

jquery fullcalendar

5
推荐指数
2
解决办法
8391
查看次数

标签 统计

cors ×1

fullcalendar ×1

java ×1

javascript ×1

jquery ×1

vert.x ×1