We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow users to compose their controllers with mixins so that they can reuse logic.
For example, they could declare a LoggingMixin this way :
LoggingMixin
@Mixin("log") public class LogMixin { @Before public void timeBefore(RoutingContext context) { context.put("timeBefore", System.currentTimeMillis()); context.next(); } @After public void logAfter(RoutingContext context) { long timeAfter = System.currentTimeMillis(); long timeBefore = Long.valueOf(context.get("timeBefore")); logger.info("time for request #0", timeAfter - timeBefore); context.next(); } }
Then in MyApiController :
MyApiController
@Controller("my/api") @Includes("log") public class MyApiController { @GET public void myApi(RoutingContext context, Payload<String> payload) { payload.set("Hello"); context.next(); } }
The text was updated successfully, but these errors were encountered:
aesteve
No branches or pull requests
Allow users to compose their controllers with mixins so that they can reuse logic.
For example, they could declare a
LoggingMixin
this way :Then in
MyApiController
:The text was updated successfully, but these errors were encountered: