javalite / activeweb

ActiveWeb moved, see below

Home Page:http://javalite.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement OPTIONS method for custom routes

ipolevoy opened this issue · comments

so, now you can have any controller:

public class OptionsController extends AppController {
    public void index() {
        header("Access-Control-Allow-Origin", "http://astalavista.baby");
        respond("OptionsController#index");
    }
}

and simply define a custom route:

route("/options/blah").to(OptionsController.class).action("index").options();

Within the controller, you can set whatever headers you need