0

Middleware for commands [closed]

asked 2022-09-12 20:13:25 +0800

emilemol gravatar image emilemol
3 1

updated 2022-09-12 20:19:34 +0800

I want to be notified when any @command gets executed in ZK. Is that possible?

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by emilemol
close date 2022-09-16 20:19:34

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-09-15 17:53:52 +0800

hawk gravatar image hawk
3205 1 5
http://hawkphoenix.blogsp... ZK Team

you can implement your PhaseListener like

public class CommandLogListener implements PhaseListener {
    @Override
    public void prePhase(Phase phase, BindContext ctx) {
        if (phase.equals(Phase.COMMAND)) {
            System.out.println("pre " + ctx.getCommandName());
        }
    }

    @Override
    public void postPhase(Phase phase, BindContext ctx) {
        if (phase.equals(Phase.COMMAND)) {
            System.out.println("post " + ctx.getCommandName());
        }
    }
}

configure in zk.xml

<library-property>
    <name>org.zkoss.bind.PhaseListener.class</name>
    <value>foo.CommandLogListener</value>
</library-property>
link publish delete flag offensive edit

Question tools

Follow

RSS

Stats

Asked: 2022-09-12 20:13:25 +0800

Seen: 22 times

Last updated: Sep 16 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More