Thanks Stephan. Problem is I just found out that createRoot gets called before handle() and hence request.getResourceRef().toString() in createRoot is still null.
If the flow is other way round then it would have solved the problem. Do u have any other way??