New to java, and this question is different from typical java workflows out there and will need some help from very experienced architect, coming from node.js background, trying to implement an architecture based on some design patterns that I already implemented in node.js and PHP and some frontend languages (including Java Swing) and I look forward to implement the same for Java Servlets.
I understand that within Servlets doGet, doPost etc. are the entry points of a request and a single instance of a servlet is instantiated and re-used concurrently for all incoming requests via multithreading.
for these design patterns (another topic, requires it's own thread) to work I need to have an uber level access to get hold of these servlet instances and set my actors on top of them as delegates/listeners.
I've read that servlets are either instantiated after the first request or loaded right with the container, so for this to be implemented I'll need them loaded at the startup so I can perform the operations on them.
Again this question is different and may require some discussion for a deep understanding, to help us to exchange things about each other worlds.
In short I need the following two things to make it work.
- A way to define my own class (let's say Uber) to have it loaded as container gets loaded.
- The Uber class then is able to get reference to loaded servlets or servlets can reach out to Uber