code: public static CmsResource getResourceWithHistory(CmsObject cms, String resourceUri) throws CmsException {
  
          CmsResource resource = null;
  
          if (resourceUri.contains(CmsRequestUtil.URL_DELIMITER)) {
              int pos = resourceUri.indexOf(CmsRequestUtil.URL_DELIMITER);
              Map<String, String[]> params = CmsRequestUtil.createParameterMap(resourceUri.substring(pos));
              if (params.containsKey(CmsHistoryResourceHandler.PARAM_VERSION)) {
                  int version = Integer.parseInt(params.get(CmsHistoryResourceHandler.PARAM_VERSION)[0]);
                  String sitemapPath = resourceUri.substring(0, pos);
                  resource = cms.readResource(sitemapPath);
                  resource = (CmsResource)cms.readResource(resource.getStructureId(), version);
              }
          }
          if (resource == null) {
              resource = cms.readResource(resourceUri);
          }
          return resource;
      }
docs: Returns the correct resource for the given URI, taken into account historical versions
  marked by the <code>version</code> parameter.<p>
  
  @param cms the current CMS context
  @param resourceUri the resource URI
  
  @return the resource, which can be an instance of {@link org.opencms.file.history.I_CmsHistoryResource}
  
  @throws CmsException if something goes wrong