To all,
thanks for the input and let me clarify what I'm trying to do. First, yes it's JSF with backing beans. Per the documentation, an application or session bean will only be instantiated when it's first called, not when the application actually starts.
So, here's the scenario: Use a ServletContextListener (which will be started with the application) and create a polling
thread within it to poll the devices in scope. It would store the results within a class variable and then results could be displayed by the pages based upon a filter (static or ajax updated). Eg.
(display page) <-> backing bean <-> query ServletContextListener.method()
<filter>
From what I've read (I'm new to web programming if you haven't figured that out), with the servlet spec 2.x, the context.getServlet is deprecated so I can't find the servlet that way to call a method. Also, if I'm reading it correctly, a ServletContextListener does not have a URL I can call?
So, I think (input would be appreciated)I could:
1) Have the Listener continuously update a context variable with a status object and have the bean read that?
2) Have the Listener call an application scope bean at startup and that would instantiate the application bean where I could put the poll thread. That bean is easily found (e.g. getBean()). However, I don't know how to do this. If there's some sample code I'd appreciate a pointer
3) Call the servlet results/add device/remove device method directly (my first choice). But I don't know how to find it within the application scope (e.g. get.Listener).
My thanks for any and all input