code: public CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException {
  
          String userName = session.getClientInformation().getUserName();
          userName = CmsJlanUsers.translateUser(userName);
          CmsContextInfo contextInfo = new CmsContextInfo(m_cms.getRequestContext());
          contextInfo.setUserName(userName);
          CmsObject newCms = OpenCms.initCmsObject(m_cms, contextInfo);
          newCms.getRequestContext().setSiteRoot(getRoot());
          newCms.getRequestContext().setCurrentProject(getProject());
          CmsObjectWrapper result = new CmsObjectWrapper(newCms, getWrappers());
          result.setAddByteOrderMark(m_addByteOrderMark);
          result.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE);
          return result;
      }
docs: Creates a CmsObjectWrapper for the current session.<p>
  
  @param session the current session
  @param connection the tree connection
  
  @return the correctly configured CmsObjectWrapper for this session
  
  @throws CmsException if something goes wrong