Impossible to cache static files:K WebFileDescriptorResource adds random UUID to file name

Hello

I tried to tune my application installation, and due to the fact that the application is delivering images, that are stored in the DB (as FileDescriptor resource), my idea was to cache the images and deliver this static contect directly by the upfront apache instance. But I was not able to deliver the content from the apache cache. I inspected the apache cache and the http requests and found out, that the file name is appended with an random UUID. So apache mod_cache cannot find the before request in the cache. Result is, that the cache is growing and no file is delivered by the cache.

So I inspected the code and found, that the WebFileDescriptorResource adds the UUID in the method

protected String getResourceName() {
    StringBuilder name = new StringBuilder();

    String fullName = StringUtils.isNotEmpty(fileName)
            ? fileName
            : fileDescriptor.getName();
    String baseName = FilenameUtils.getBaseName(fullName);

    if (StringUtils.isEmpty(baseName)) {
        return UUID.randomUUID().toString();
    }

    String extension;
    if (StringUtils.isEmpty(fileName)
            && StringUtils.isNotEmpty(fileDescriptor.getExtension())) {
        extension = fileDescriptor.getExtension();
    } else {
        extension = FilenameUtils.getExtension(fullName);
    }

    return name.append(baseName)
            .append('-')
            .append(UUID.randomUUID().toString())
            .append('.')
            .append(extension)
            .toString();
}

I want to propse to change the last statement to.

return name.append().append(baseName)
            .append('-')
            .append(fileDescriptor.getId())
            .append('.')
            .append(extension)
            .toString();