code: public static CmsJspResourceWrapper wrap(CmsObject cms, CmsResource res) {
  
          CmsJspResourceWrapper result = null;
          if ((cms != null) && (res != null)) {
              if (res instanceof CmsJspResourceWrapper) {
                  CmsJspResourceWrapper wrapper = (CmsJspResourceWrapper)res;
                  if (cms.getRequestContext().getSiteRoot().equals(wrapper.getRequestContext().getSiteRoot())) {
                      result = wrapper;
                  } else {
                      result = new CmsJspResourceWrapper(cms, res);
                  }
              } else {
                  result = new CmsJspResourceWrapper(cms, res);
              }
          }
          return result;
      }
docs: Factory method to create a new {@link CmsJspResourceWrapper} instance from a {@link CmsResource}.<p>
  
  In case the parameter resource already is a wrapped resource AND the OpenCms request context is
  the same as the provided context, the parameter object is returned.<p>
  
  @param cms the current CMS context
  @param res the resource to wrap
  
  @return a new instance of a {@link CmsJspResourceWrapper}