class LogFileHandler {

    public void writeFileContentToResponse(final HttpServletRequest req, final HttpServletResponse resp, final String pathInfo, final Path path)
        throws IOException {
        String requestedFilename = pathInfo.substring(1);
        InputStream messageFileInputStream = messageFileReader.readFile(requestedFilename, path);
        if (messageFileExists(messageFileInputStream)) {
            writeFileToResponse(req, resp, requestedFilename, messageFileInputStream);
        } else {
            writeErrorToResponse(resp);
        }
    }

}