Java – @ postconstruct is called multiple times for the @ conversationscoped bean

I have a @ conversationscoped bean with a start method, as follows:

@postconstruct
public void start() {
    if (conversation.isTransient()) {
        conversation.begin();
        log.debug("conversation.getId(): " + conversation.getId());
    }
}

My problem is that every time I refresh the page, a new session will be started, and every time I make Ajax calls to methods in the bean, a new session will be started (this is my main problem)

What I really want to happen is to let Sam talk around until I manually call conversation end(). What did I miss here?

Solution

Have you checked whether the (Ajax) call contains the session ID parameter (CID)?

If missing, each call starts a new conversation

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>