I was happy enough with simple solution, which required saving document
before adding new object:
#set($redirect=$xwiki.getRequestURL())
{{html}}<a
href="$tdoc.getURL("objectadd","classname=Space.ObjectClass&xredirect=
${redirect}")&form_token=$!services.csrf.getToken()">Add
object</a>{{/html}}
Though for "average users" it could be hard to digest. Therefore I'm
analysing Object edit mode form, where it works. I checked that link
generation in #macro(displayAddObject $class) of the editobject.vm
doesn't do the magic and I suppose it is somewhere in JavaScript.
Can you provide some hints how it is actually done?
Thanks in advance!
Valdis