Where is your handler running? It sounds like it is running outside
the ServletInitialHandler, which is what sets the attachment key.
If that is the case you can either move the handler to be run after
the ServletInitialHandler, or save the ServletContext somewhere
static.
Stuart
On Wed, Feb 15, 2017 at 9:34 PM, Rohan Emmanuel
<rohan.emmanuel07(a)gmail.com> wrote:
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
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev