Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Trigger HttpSessionBindingListener in AEM

Nandujee
Level 3
Level 3

Hi, 

I am trying to trigger the valueBound method of HttpSessionBindingListener. Whenever I set the session attribute.It is not working.

I have written class which implements HttpSessionBindingListener 

like

public class SessionBinding implements HttpSessionBindingListener, java.io.Serializable  {

@Override
    public  void valueBound(HttpSessionBindingEvent paramHttpSessionBindingEvent) {
        LOG.info("Session bounded ");
        
    }

@Override
    public void valueUnbound(
            HttpSessionBindingEvent paramHttpSessionBindingEvent) {}

}

In my servlet,

SlingServlet(paths = "/bin/testing", methods = "POST")
public class TestServlet extends SlingAllMethodsServlet {

protected void doGet(SlingHttpServletRequest request,
            SlingHttpServletResponse response) throws ServletException,
            IOException {

HttpSession session = request.getSession();
        session.setAttribute("test", "test");

}

}

I set session attribute.But it doesnt called my valueBound method

Could some one help me to resolve this issue. 

Am I missing any configuration here?

Thanks

Nanda

1 Reply