code: protected CmsObject updateContext(HttpServletRequest request, CmsObject cms) throws CmsException {
  
          // get the right site for the request
          String siteRoot = null;
          boolean isWorkplace = cms.getRequestContext().getUri().startsWith("/system/workplace/")
              || request.getRequestURI().startsWith(OpenCms.getSystemInfo().getWorkplaceContext());
          if (isWorkplace && getRoleManager().hasRole(cms, CmsRole.ELEMENT_AUTHOR)) {
              // keep the site root for workplace requests
              siteRoot = cms.getRequestContext().getSiteRoot();
          } else {
              CmsSite site = OpenCms.getSiteManager().matchRequest(request);
              siteRoot = site.getSiteRoot();
          }
          return initCmsObject(
              request,
              cms.getRequestContext().getCurrentUser(),
              siteRoot,
              cms.getRequestContext().getCurrentProject().getUuid(),
              cms.getRequestContext().getOuFqn());
      }
docs: This method updates the request context information.<p>
  
  The update information is:<br>
  <ul>
  <li>Requested Url</li>
  <li>Locale</li>
  <li>Encoding</li>
  <li>Remote Address</li>
  <li>Request Time</li>
  </ul>
  
  @param request the current request
  @param cms the cms object to update the request context for
  
  @return a new updated cms context
  
  @throws CmsException if something goes wrong