code: public void changeSite(String siteRoot) {
  
          if (!getCmsObject().getRequestContext().getSiteRoot().equals(siteRoot)) {
              getCmsObject().getRequestContext().setSiteRoot(siteRoot);
              getWorkplaceSettings().setSite(siteRoot);
              OpenCms.getSessionManager().updateSessionInfo(getCmsObject(), getHttpSession());
          }
      }
docs: Changes to the given site. Will update session and workplace settings.<p>
  
  @param siteRoot the site to change to