1 package com.atlassian.plugin.webresource.transformer;
2
3 import com.atlassian.plugin.elements.ResourceLocation;
4 import com.atlassian.plugin.servlet.DownloadableResource;
5 import org.dom4j.Element;
6
7 /**
8 * Transforms a downloadable resource. Instances are created per request, though it is assumed the resource will have
9 * the appropriate caching headers to ensure the same user doesn't download it twice.
10 *
11 * @since 2.5.0
12 */
13 public interface WebResourceTransformer
14 {
15 /**
16 * Transforms the downloadable resource by returning a new one.
17 *
18 * @param configElement The element where it was used. This is provided to allow the transformer to
19 * take additional configuration in the form of custom attributes or sub-elements.
20 * @param location The original resource location
21 * @param filePath Extra path information. Cannot be null, but can be an empty string if no extra path information
22 * @param nextResource The original resource
23 * @return The new resource representing the transformed resource
24 */
25 DownloadableResource transform(Element configElement, ResourceLocation location, String filePath, DownloadableResource nextResource);
26 }