protected void process ( HttpServletRequest request , HttpServletResponse response , String fileName ) throws IOException { // TODO put this html code in a template response . setContentType ( "text/html" ) ; response . setCharacterEncoding ( "UTF-8" ) ; response . setStatus ( 200 ) ; FileBackedStringBuffer buffer = new FileBackedStringBuffer ( ) ; buffer . append ( "<html><head><title>" ) ; buffer . append ( request . getRemoteHost ( ) ) ; buffer . append ( "</title><script type=text/javascript>" ) ; buffer . append ( "function submitform() { document.myform.submit(); } </script>" ) ; buffer . append ( "</head><body><H1>View Logs on - " ) ; buffer . append ( request . getRemoteHost ( ) ) . append ( "</H1>" ) ; if ( isLogsDirectoryEmpty ( ) ) { buffer . append ( "<br>No Logs available.</br></body></html>" ) ; dumpStringToStream ( buffer , response . getOutputStream ( ) ) ; return ; } buffer . append ( appendMoreLogsLink ( fileName , request . getRequestURL ( ) . toString ( ) ) ) ; buffer . append ( renderLogFileContents ( fileName ) ) ; buffer . append ( "</body></html>" ) ; dumpStringToStream ( buffer , response . getOutputStream ( ) ) ; }
This method display the log file content