Annotation Interface Ajax
Marks a annotated
@Callable /
@Task method as a method invoked
via Ajax requests by default.If there are more than one methods of the same name,
all methods are called via Ajax requests.
import org.wcardinal.controller.annotation.Callable;
import org.wcardinal.controller.annotation.Controller;
@Controller
class MyController {
@Ajax
@Callable
int callable() {
return 1;
}
}
Please note that this behavior can be overriden by JavaScript.
For instance, the following JavaScript calls MyController#callable()
via WebSocket.
<script src="my-controller"></script> <script> console.log(await myController.callable.unajax().call()); // Prints 1 </script>
- 関連項目: