code: @SuppressWarnings("javadoc")
      public void chtype(CmsRequestContext context, CmsResource resource, int type)
      throws CmsException, CmsSecurityException {
  
          CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
          try {
              checkOfflineProject(dbc);
              checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
              if (CmsResourceTypeJsp.isJspTypeId(type)) {
                  // security check preventing the creation of a jsp file without permissions
                  checkRoleForResource(dbc, CmsRole.VFS_MANAGER, resource);
              }
              m_driverManager.chtype(dbc, resource, type);
          } catch (Exception e) {
              dbc.report(
                  null,
                  Messages.get().container(Messages.ERR_CHANGE_RESOURCE_TYPE_1, context.getSitePath(resource)),
                  e);
          } finally {
              dbc.clear();
          }
      }
docs: Changes the resource type of a resource.<p>
  
  OpenCms handles resources according to the resource type,
  not the file suffix. This is e.g. why a JSP in OpenCms can have the
  suffix ".html" instead of ".jsp" only. Changing the resource type
  makes sense e.g. if you want to make a plain text file a JSP resource,
  or a binary file an image, etc.<p>
  
  @param context the current request context
  @param resource the resource to change the type for
  @param type the new resource type for this resource
  
  @throws CmsException if something goes wrong
  @throws CmsSecurityException if the user has insufficient permission for the given resource (({@link CmsPermissionSet#ACCESS_WRITE} required))
  
  @see org.opencms.file.types.I_CmsResourceType#chtype(CmsObject, CmsSecurityManager, CmsResource, int)
  @see CmsObject#chtype(String, int)