protected void setLink(CmsObject cms, String resourcePath) {

        String link = resourcePath;
        try {
            // make sure the res is a folder
            cms.readFolder(resourcePath);

            // adjust the path
            if (resourcePath.endsWith(CmsToolManager.TOOLPATH_SEPARATOR)) {
                resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf(CmsToolManager.TOOLPATH_SEPARATOR));
            }

            // set admin page as link
            link = CmsToolManager.VIEW_JSPPAGE_LOCATION;

            // try to use the folder default file as link
            CmsProperty prop = cms.readPropertyObject(resourcePath, CmsPropertyDefinition.PROPERTY_DEFAULT_FILE, false);
            String defFile = "index.jsp";
            if (!prop.isNullProperty()) {
                defFile = prop.getValue();
            }
            if (!defFile.startsWith(CmsToolManager.TOOLPATH_SEPARATOR)) {
                // try to use this relative link
                defFile = resourcePath + CmsToolManager.TOOLPATH_SEPARATOR + defFile;
            }
            if (defFile.indexOf("?") > 0) {
                if (cms.existsResource(defFile.substring(0, defFile.indexOf("?")))) {
                    link = defFile;
                }
            } else if (cms.existsResource(defFile)) {
                link = defFile;
            }
        } catch (CmsException e) {
            // not a folder or no default file, ignore
        }

        setLink(link);
    }
protected void setLink ( CmsObject cms , String resourcePath ) { String link = resourcePath ; try { cms . readFolder ( resourcePath ) ; if ( resourcePath . endsWith ( CmsToolManager . TOOLPATH_SEPARATOR ) ) { resourcePath = resourcePath . substring ( 0 , resourcePath . lastIndexOf ( CmsToolManager . TOOLPATH_SEPARATOR ) ) ; } link = CmsToolManager . VIEW_JSPPAGE_LOCATION ; CmsProperty prop = cms . readPropertyObject ( resourcePath , CmsPropertyDefinition . PROPERTY_DEFAULT_FILE , false ) ; String defFile = "index.jsp" ; if ( ! prop . isNullProperty ( ) ) { defFile = prop . getValue ( ) ; } if ( ! defFile . startsWith ( CmsToolManager . TOOLPATH_SEPARATOR ) ) { defFile = resourcePath + CmsToolManager . TOOLPATH_SEPARATOR + defFile ; } if ( defFile . indexOf ( "?" ) > 0 ) { if ( cms . existsResource ( defFile . substring ( 0 , defFile . indexOf ( "?" ) ) ) ) { link = defFile ; } } else if ( cms . existsResource ( defFile ) ) { link = defFile ; } } catch ( CmsException e ) { } setLink ( link ) ; }
Sets the link for the given resource.<p>

Use the <code>resourcePath</code> as link if it is not a folder.

If it is a folder, try to use the folder default file property value as link.
if not use the {@link CmsToolManager#VIEW_JSPPAGE_LOCATION}.

@param cms the cms context
@param resourcePath the path to the resource to set the link for