1

When trying to connect to a restful controller in activeweb from a nodejs application chrome is sending options preflight request for delete and put methods, the preflight request needs to be handled by emitting a 200 response from the server.

As OPTIONS is not handled in restful controllers, I tried add below code to RouteConfig

boolean isMethodOptions = RequestUtils.isMethod("OPTIONS");
if (isMethodOptions) {
    route("/*").to(HomeController.class).action("optionResponse");
}

In HomeController

public void optionResponse(){
    respond("").status(200);
}

This doesn't work. How can this be done within the activeweb application?

4

1 回答 1

0

此功能需要添加到框架中。请参阅此问题: https ://github.com/javalite/activeweb/issues/306 请在其中添加您的评论以启动实施。

于 2016-08-15T04:46:34.487 回答