Using DHIS2 resources from an App


We are developing an App for the latest version of DHIS2 and we want it to look and work similar to the rest of DHIS2.
For example, we need an “org unit tree” just like the ones that appear in the left bar in some modules.

Because of that, we thought of catching the resources directly from the “dhis-web-commons” folder. The problem is that some of the files there don’t work with the root url, but with a relative url like “…/dhis-web-commons-ajax-json/getOrganisationUnitTree.action”.

This doesn’t work properly if we install the app in some folder, like"/apps/myApp/", because it searches the resources in the folder “/apps”, instead of the root.

Our question is: are we doing something wrong ? Is DHIS2 not designed to work that way or there is another way to do it?