Hello all,
I am looking for some very basic help with trying to build a first module. I have very little experience with java, and also very little understanding of the Spring framework, and for now I’m looking just to make a simple “Hello World” type of module.
I’m basically trying to understand how openmrs/spring controllers work to give a responce to a http request at a url.
Eventually I’m trying to make a module that runs a Dicom query on the server side (using dcm4che) to a PACS system, and returns a list of studies as a JSON response. I think I don’t have the java skill to do this in a ‘correct’ way, so for now I’m aiming for a simple approach that works.
Steps I’ve taken:
-
installed openmrs sdk
-
ran
mvn openmrs-sdk:create-project
Created a platform 1.12.0 module, gave a name (pacsquery), etc. -
I belive this bug is affecting me, so I edit
omod/src/main/java/org/openmrs/module/pacsquery/web/controller/PacsQueryController.java
to use my modules artifactId/**
-
This class configured as controller using annotation and mapped with the URL of
-
‘module/pacsquery/pacsquery.form’. */ @Controller(“pacsquery.PacsQueryController”) @RequestMapping(value = “module/pacsquery/pacsquery.form”) public class PacsQueryController {
/** Logger for this class and subclasses */ protected final Log log = LogFactory.getLog(getClass()); @Autowired UserService userService; /** Success form view name */ private final String VIEW = "/module/pacsquery/pacsquery"; /** * Initially called after the getUsers method to get the landing form name * * @return String form view name */ @RequestMapping(method = RequestMethod.GET) public String onGet() { return VIEW; }
…
-
-
I run
mvn openmrs-sdk:build openmrs-sdk:run -DserverId=tests1
-
I go to http://MYIP:8080/openmrs/module/pacsquery/pacsquery.form and it gives an error, in the console:
WARN - DispatcherServlet.noHandlerFound(1108) |2017-06-09 15:34:30,932| No mapping found for HTTP request with URI [/openmrs/module/pacsquery/pacsquery.form] in DispatcherServlet with name 'openmrs'
I’m wondering, what are the steps missing to have a module with a working controller?