/** * Delivers the plain uninterpreted resource with escaped XML.<p> * * This is intended for viewing historical versions.<p> * * @param cms the initialized CmsObject which provides user permissions * @param file the requested OpenCms VFS resource * @param req the servlet request * @param res the servlet response * * @throws IOException might be thrown by the servlet environment * @throws CmsException in case of errors accessing OpenCms functions */ protected void showSource(CmsObject cms, CmsResource file, HttpServletRequest req, HttpServletResponse res) throws CmsException, IOException { CmsResource historyResource = (CmsResource)CmsHistoryResourceHandler.getHistoryResource(req); if (historyResource == null) { historyResource = file; } CmsFile historyFile = cms.readFile(historyResource); String content = new String(historyFile.getContents()); // change the content-type header so that browsers show plain text res.setContentLength(content.length()); res.setContentType("text/plain"); Writer out = res.getWriter(); out.write(content); }
/** * Delivers the plain uninterpreted resource with escaped XML.<p> * * This is intended for viewing historical versions.<p> * * @param cms the initialized CmsObject which provides user permissions * @param file the requested OpenCms VFS resource * @param req the servlet request * @param res the servlet response * * @throws IOException might be thrown by the servlet environment * @throws CmsException in case of errors accessing OpenCms functions */ protected void showSource(CmsObject cms, CmsResource file, HttpServletRequest req, HttpServletResponse res) throws CmsException, IOException { CmsResource historyResource = (CmsResource)CmsHistoryResourceHandler.getHistoryResource(req); if (historyResource == null) { historyResource = file; } CmsFile historyFile = cms.readFile(historyResource); String content = new String(historyFile.getContents()); // change the content-type header so that browsers show plain text res.setContentLength(content.length()); res.setContentType("text/plain"); Writer out = res.getWriter(); out.write(content); out.close(); }
/** * Returns the current container page resource.<p> * * @return the current container page resource */ private CmsResource getContainerPage() { try { if (m_pageResource == null) { // get the container page itself, checking the history first m_pageResource = (CmsResource)CmsHistoryResourceHandler.getHistoryResource(m_request); if (m_pageResource == null) { m_pageResource = m_cms.readResource(m_cms.getRequestContext().getUri()); } } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } return m_pageResource; }
if (containerPage == null) { CmsResource pageResource = (CmsResource)CmsHistoryResourceHandler.getHistoryResource(req); if (pageResource == null) { pageResource = cms.readResource(requestUri);
if (containerPage == null) { CmsResource pageResource = (CmsResource)CmsHistoryResourceHandler.getHistoryResource(req); if (pageResource == null) { pageResource = cms.readResource(requestUri);