/** * Returns an input stream baded on the file contents.<p> * * @see javax.activation.DataSource#getInputStream() */ public InputStream getInputStream() { return new ByteArrayInputStream(m_file.getContents()); }
/** * Returns an input stream baded on the file contents.<p> * * @see javax.activation.DataSource#getInputStream() */ public InputStream getInputStream() { return new ByteArrayInputStream(m_file.getContents()); }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale locale, HttpServletRequest req, HttpServletResponse res) throws CmsException { return cms.readFile(resource).getContents(); }
/** * @see org.opencms.loader.I_CmsResourceLoader#service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ public void service(CmsObject cms, CmsResource resource, ServletRequest req, ServletResponse res) throws CmsException, IOException { res.getOutputStream().write(cms.readFile(resource).getContents()); }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale locale, HttpServletRequest req, HttpServletResponse res) throws CmsException { return cms.readFile(resource).getContents(); }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale locale, HttpServletRequest req, HttpServletResponse res) throws CmsException { return cms.readFile(resource).getContents(); }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale locale, HttpServletRequest req, HttpServletResponse res) throws CmsException { return cms.readFile(resource).getContents(); }
/** * @see org.opencms.loader.I_CmsResourceLoader#service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ public void service(CmsObject cms, CmsResource resource, ServletRequest req, ServletResponse res) throws CmsException, IOException { res.getOutputStream().write(cms.readFile(resource).getContents()); }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale locale, HttpServletRequest req, HttpServletResponse res) throws CmsException { return cms.readFile(resource).getContents(); }
/** * Returns the file contents of the raw VFS file object as String.<p> * * Usage example on a JSP with the JSTL:<pre> * <cms:resourceload ... > * <cms:resourceaccess var="res" /> * String content of the resource: ${res.fileContentAsString} * </cms:resourceload></pre> * * @return the file contents of the raw VFS file object as String */ public String getFileContentAsString() { return new String(getFile().getContents()); }
/** * Loads the content of the encapsulated CmsResource and stores it within the * CmsContentCheckResource. If the content is already existing, it is not loaded * again.<p> * * @param cms the CmsObject * @throws CmsException if loading of the content fails */ public void upgradeContent(CmsObject cms) throws CmsException { if (m_content == null) { m_content = cms.readFile(m_resource).getContents(); } }
/** * Returns a scaled version of the given image file according this image scalers parameters.<p> * * @param file the image file to scale * * @return a scaled version of the given image file according to the provided scaler parameters */ public byte[] scaleImage(CmsFile file) { return scaleImage(file.getContents(), file.getRootPath()); }
/** * Returns a scaled version of the given image file according this image scalers parameters.<p> * * @param file the image file to scale * * @return a scaled version of the given image file according to the provided scaler parameters */ public byte[] scaleImage(CmsFile file) { return scaleImage(file.getContents(), file.getRootPath()); }
/** * Rewrites the content of the given file.<p> * * @param resource the resource to rewrite the content for * * @throws CmsException if something goes wrong */ private static void hardTouch(CmsObject cms, CmsResource resource) throws CmsException { CmsFile file = cms.readFile(resource); file.setContents(file.getContents()); cms.writeFile(file); }
/** * Returns the selected files contentsls as a String.<p> * * @param filename the file to read the contents from * @throws CmsException if something goes wrong * @return the selected files contents */ public String readFileContent(String filename) throws CmsException { filename = CmsLinkManager.getAbsoluteUri( filename, CmsResource.getFolderPath(m_cms.getRequestContext().getUri())); CmsFile file = m_cms.readFile(filename, CmsResourceFilter.IGNORE_EXPIRATION); return new String(file.getContents()); }
/** * Returns the selected files contentsls as a String.<p> * * @param filename the file to read the contents from * @throws CmsException if something goes wrong * @return the selected files contents */ public String readFileContent(String filename) throws CmsException { filename = CmsLinkManager.getAbsoluteUri( filename, CmsResource.getFolderPath(m_cms.getRequestContext().getUri())); CmsFile file = m_cms.readFile(filename, CmsResourceFilter.IGNORE_EXPIRATION); return new String(file.getContents()); }
/** * Rewrites the content of the given file.<p> * * @param resource the resource to rewrite the content for * * @throws CmsException if something goes wrong */ private void hardTouch(CmsResource resource) throws CmsException { CmsFile file = getCms().readFile(resource); file.setContents(file.getContents()); getCms().writeFile(file); } }
/** * @see org.opencms.relations.I_CmsLinkParseable#parseLinks(org.opencms.file.CmsObject, org.opencms.file.CmsFile) */ public List<CmsLink> parseLinks(CmsObject cms, CmsFile file) { CmsJspLinkMacroResolver macroResolver = new CmsJspLinkMacroResolver(cms, file.getRootPath(), false); String encoding = CmsLocaleManager.getResourceEncoding(cms, file); String content = CmsEncoder.createString(file.getContents(), encoding); macroResolver.resolveMacros(content); // ignore return value return macroResolver.getLinks(); }
/** * @see org.opencms.relations.I_CmsLinkParseable#parseLinks(org.opencms.file.CmsObject, org.opencms.file.CmsFile) */ public List parseLinks(CmsObject cms, CmsFile file) { CmsJspLinkMacroResolver macroResolver = new CmsJspLinkMacroResolver(cms, file.getRootPath(), false); String encoding = CmsLocaleManager.getResourceEncoding(cms, file); String content = CmsEncoder.createString(file.getContents(), encoding); macroResolver.resolveMacros(content); // ignore return value return macroResolver.getLinks(); }
/** * Rewrites the content of the given file.<p> * * @param resource the resource to rewrite the content for * * @throws CmsException if something goes wrong */ private void hardTouch(CmsResource resource) throws CmsException { CmsFile file = m_context.getCms().readFile(resource); CmsObject cms = OpenCms.initCmsObject(m_context.getCms()); cms.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); file.setContents(file.getContents()); cms.writeFile(file); }