@Test public void define() { WebService.Context context = new WebService.Context(); ws.define(context); WebService.Controller controller = context.controller(ActivitiesWs.ENDPOINT); assertThat(controller).isNotNull(); assertThat(controller.actions()).hasSize(1); assertThat(controller.action(SearchAction.SEARCH_ACTION)).isNotNull(); }
private WebService.Action getAction(String controllerPath, String actionKey) { WebService.Controller controller = context.controller(controllerPath); if (controller == null) { throw new BadRequestException(String.format("Unknown web service: %s", controllerPath)); } WebService.Action action = controller.action(actionKey); if (action == null) { throw new BadRequestException( String.format("Unknown action: %s/%s", controllerPath, actionKey)); } return action; }
/** Used by Ruby on Rails to add ws routes. See WEB_INF/lib/java_ws_routing.rb */ public List<WebService.Controller> controllers() { return context.controllers(); }