class ResourceFileNameHandler {

    public void writeResourceFile(final HttpServletResponse resp, final String path, final Path filePath) throws IOException {
        String requestedFilename = path.substring(1);
        InputStream messageFileInputStream = fileReader.readFile(requestedFilename, filePath);
        if (messageFileExists(messageFileInputStream)) {
            writeResourceFileInResponse(resp, requestedFilename, messageFileInputStream);
        } else {
            writeErrorToResponse(resp);
        }
    }

}