class MessageFileHandler {

    public void writeFileNamesToResponse(final HttpServletResponse resp, final Path path) throws IOException {
        FileListJsonProperties properties = configurationAccess.getProperties().getFileListProperties();
        PrintWriter out = resp.getWriter();
        resp.setContentType(APPLICATION_JSON);
        out.write(messageFileJsonBuilder.buildMessageFileListJson(path.toFile(), properties.getMaximumCountOfMessages()));
        out.flush();
        out.close();
    }

}