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?

Partha
  • 15
  • 4
  • 1
    I do not see a reason why Activeweb RESTful controllers would not support an OPTIONS method. I will do some digging and respond soon with an answer. – ipolevoy Aug 15 '16 at 00:49

1 Answers1

0

This feature needs to be added to the framework. See this issue: https://github.com/javalite/activeweb/issues/306 Please, add your comments to it to kick-start implementation.

ipolevoy
  • 5,432
  • 2
  • 31
  • 46