You should take a look at the java code provided with the oAuth Module in the Mendix appstore. There is something done like you described.
Thijs,
Below is an example on how to retrieve the account based on an ID in your example. I'm assuming that the ID returned in the URL is an attribute of the procesInfo entity.
import java.util.List;
import com.mendix.core.Core;
import com.mendix.systemwideinterfaces.core.UserAction;
import com.mendix.systemwideinterfaces.core.IMendixObject;
import myfirstmodule.proxies.*;
// BEGIN USER CODE
String xpathQuery = "//MyFirstModule.procesInfo["+procesInfo.MemberNames.IDAttribute.toString()+"='"+inputID+"']";
List<IMendixObject> entityList =Core.retrieveXPathQuery(getContext(), xpathQuery);
if(entityList.get(0)!= null){
IMendixObject procesInfoObj =entityList.get(0);
List<IMendixObject> accList = Core.retrieveByPath(getContext(), procesInfoObj, "MyFirstModule."+procesInfo.MemberNames.procesInfo_Account.name());
if(accList.get(0) != null){
return accList.get(0);
}
else return null;
}
return null;
// END USER CODE
First an xpath query string is created allowing you to retrieve a list of procesInfo objects. The list will consist of 1 record as the ID will be unique. The from the list the first entry is retrieved. Then with the retrieveByPath method the account list is retrieved. This again is just 1 account so the index 0 is returned in this example.
Hope this helps in building your custom request handler.