Proper self-link for JSONVersion.
Also record workspace name and language code in the ThreadLocal since this information is needed elsewhere as well.
Fix URI generation to properly include workspace and language.
Updated with resolution on JSON-P.
Extracted session closing into method and protect logout by checking whether the session is live.