...
Let's consider a specific example. We want to move ObsResource to 2.x. You need to start from changing dependencies in your poms and creating a single controller to define your module namespace. See Adding a Web Service Step by Step Guide for Core Developers.
- Open ObsResource.java and remove @Handler. Change the resource annotation to @Resource(name = "obs", supportedClass = Obs.class, supportedOpenmrsVersions = { "1.8.", "1.9." }). Fix imports if any.
- Open ObsController.java. You can see that it has two custom search methods. Create ObsSearchHandler implementing SearchHandler, which can do the same searches depending on which request parameter is given. The alternative is to implement searches directly in the resource by overriding the doSearch method. We recommend SearchHandler as it is more robust.
- Remove ObsController.java. It is no longer necessary since all requests are handled by the main controller and you moved custom searches to ObsSearchHandler.
- If you had ObsControllerTest.java which called ObsController methods, then you need to change it to extend MainResourceControllerTest and call newGetRequest, newPostRequest or newDeleteRequest with the correct URL. See the new ObsController1_8Test.java for example.
...