Stateless Apache Wicket stateless pages/requests

后端 未结 5 1518
感情败类
感情败类 2021-02-06 13:53

So I was reading another question under the Wicket tag comparing Apache Wicket and Apache Click. A concise explanation, in my opinion. I am more familiar with the Wicket world t

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-06 14:21

    Wicket is stateless by default, and switches into stateful mode when it needs to. It is very easy to break the stateless mode.

    I've found it useful to annotate intended stateless pages and stateless components with @StatelessComponent, which is found in the wicket-devutils project. I then add a StatelessChecker in my WebApplication.init() method like this:

    protected void init(){
        ...
        this.addPostComponentOnBeforeRenderListener(new StatelessChecker());
        ...
    }
    

    This way I always get an exception about the offending stateful component.

提交回复
热议问题