当尝试从nodejs应用程序连接到activeweb中的restful控制器时,chrome正在发送删除和放置方法的选项预检请求,需要通过从服务器发出200响应来处理预检请求。
由于OPTIONS未在restful controller中处理,我尝试将以下代码添加到RouteConfig
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
在HomeController中
boolean isMethodOptions = RequestUtils.isMethod("OPTIONS");
if (isMethodOptions) {
route("/*").to(HomeController.class).action("optionResponse");
}
这不起作用。如何在activeweb应用程序中完成?