I created a test controller which looks like this
@Controller
public class TestController {
private final Log log = LogFactory.getLog(getClass());
@RequestMapping("/test/{id}/{resource:.+}")
@ResponseBody
public JSONObject onGet(@PathVariable(value = "id") String id,
@PathVariable(value = "resource") String resource, @RequestParam(value = "view", required = false) String view,
HttpServletResponse response) throws JSONException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", id);
jsonObject.put("resource", resource);
jsonObject.put("view", view);
log.info(jsonObject.toString());
return jsonObject;
}
}
http://localhost:8080/openmrs/test/b1cf27a3-8fd9-4e9f-a578-70bce21fa585/apple.jpg results in 404
and http://localhost:8080/openmrs/test/b1cf27a3-8fd9-4e9f-a578-70bce21fa585/
<org.json.JSONObject>
<map>
<entry>
<string>id</string>
<string>b1cf27a3-8fd9-4e9f-a578-70bce21fa585</string>
</entry>
<entry>
<string>resource</string>
<string>index.htm</string>
</entry>
</map>
</org.json.JSONObject>
Am I missing something here? Do I have to add some config/filters?