/** * Reads the requested resource from the OpenCms VFS, * and in case a directory name is requested, the default files of the * directory will be looked up and the first match is returned.<p> * * The resource that is returned is always a <code>{@link org.opencms.file.CmsFile}</code>, * even though the content will usually not be loaded in the result. Folders are never returned since * the point of this method is really to load the default file if just a folder name is requested.<p> * * The URI stored in the given OpenCms user context will be changed to the URI of the resource * that was found and returned.<p> * * Implementing and configuring an <code>{@link I_CmsResourceInit}</code> handler * allows to customize the process of default resource selection.<p> * * @param cms the current users OpenCms context * @param resourceName the path of the requested resource in the OpenCms VFS * @param req the current http request * @param res the current http response * @return the requested resource read from the VFS * * @throws CmsException in case the requested file does not exist or the user has insufficient access permissions */ public static CmsResource initResource( CmsObject cms, String resourceName, HttpServletRequest req, HttpServletResponse res) throws CmsException { return OpenCmsCore.getInstance().initResource(cms, resourceName, req, res); }
/** * Reads the requested resource from the OpenCms VFS, * and in case a directory name is requested, the default files of the * directory will be looked up and the first match is returned.<p> * * The resource that is returned is always a <code>{@link org.opencms.file.CmsFile}</code>, * even though the content will usually not be loaded in the result. Folders are never returned since * the point of this method is really to load the default file if just a folder name is requested.<p> * * The URI stored in the given OpenCms user context will be changed to the URI of the resource * that was found and returned.<p> * * Implementing and configuring an <code>{@link I_CmsResourceInit}</code> handler * allows to customize the process of default resource selection.<p> * * @param cms the current users OpenCms context * @param resourceName the path of the requested resource in the OpenCms VFS * @param req the current http request * @param res the current http response * @return the requested resource read from the VFS * * @throws CmsException in case the requested file does not exist or the user has insufficient access permissions */ public static CmsResource initResource( CmsObject cms, String resourceName, HttpServletRequest req, HttpServletResponse res) throws CmsException { return OpenCmsCore.getInstance().initResource(cms, resourceName, req, res); }
/** * Displays a resource from the OpenCms by writing the result to the provided * Servlet response output stream.<p> * * @param req the current servlet request * @param res the current servlet response */ protected void showResource(HttpServletRequest req, HttpServletResponse res) { CmsObject cms = null; try { cms = initCmsObject(req, res); // user is initialized, now deliver the requested resource CmsResource resource = initResource(cms, cms.getRequestContext().getUri(), req, res); if (resource != null) { // a file was read, go on process it m_resourceManager.loadResource(cms, resource, req, res); m_sessionManager.updateSessionInfo(cms, req); } } catch (Throwable t) { errorHandling(cms, req, res, t); } }
CmsResource resource = initResource(cms, cms.getRequestContext().getUri(), req, res); if (resource != null) {
try { alternativeResource = initResource(adminCms, path, req, null); if (alternativeResource != null) { propertyLoginForm = adminCms.readPropertyObject(