I am using wildfly 10 and have a filter in my web application which will set a attribute in the servlet context.

 

public void init(FilterConfig arg0)

    throws ServletException

  {

   ServletContext sc = arg0.getServletContext();

   System.out.println("setting the servlet context");

   sc.setAttribute("ha","ha is enabled for this application");

  }

 

I want to get this attribute in one of my httphandler.

 

ServletRequestContext servletreqcontext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);

    System.out.println("servletreqcontext-="+servletreqcontext);

 

the above code is returing NULL.

Any idea how can i get a handle on the  servletContext in httphandler to get this attribute?


--
Regards,
Rohan Emmanuel