How can I do something similar from within the radiology module and still deploy it to openmrs. It configures it’s own application context inside the web.xml. Also I need to declare some servlets(spring dispatcher and fhir servlet) with their own mappings. OpenMRS modules don’t have a web.xml file. How can I achieve this?
It would be nice if the FHIR module could be extended to support other modules (like this one), so modules could leverage a growing & increasingly robust FHIR base and focus on their needs.
@ivange94, this wiki page describes how to define a module in a servlet: https://wiki.openmrs.org/x/RRAz (@wyclif is this page still up-to-date? Does Platform 2.0 + the newer servlet spec mean we have a new preferred way for modules to define servlets?)
java.lang.IllegalStateException: Started
at org.eclipse.jetty.servlet.BaseHolder.illegalStateIfContextStarted(BaseHolder.java:181)
at org.eclipse.jetty.servlet.ServletHolder$Registration.addMapping(ServletHolder.java:988)
at org.openmrs.web.WebComponentRegistrar.addMappings(WebComponentRegistrar.java:69)
at org.openmrs.web.WebComponentRegistrar.setServletContext(WebComponentRegistrar.java:34)
What the above exception means is that, it is illegal to do so after the servlet context was already initialised and started.
In summary, our custom module servlet strategy is, for now, the best and hence recommended.
I assumed that we used this new dynamic way in the legacyui module because the old Module Servlet approach was insufficient for some reason. Is there a limitation on the old way, such that sometimes you’re required to do the new way?
@burke Yes. We will need to brainstorm on how we can integrate other modules. Currently FHIR depends on some modules which uses those module APIs to support resources.