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();
    }
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 ( ) ) ; res . setContentLength ( content . length ( ) ) ; res . setContentType ( "text/plain" ) ; Writer out = res . getWriter ( ) ; out . write ( content ) ; out . close ( ) ; }
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