public abstract class CharSequenceDownloadableResource extends AbstractTransformedDownloadableResource
encoding() to customize the character encoding of the underlying content and transformed content.
For example, here is a minimal transformer that prepends text to the underlying resource:
public class PrefixTransformer implements WebResourceTransformer
{
public DownloadableResource transform(Element configElement, ResourceLocation location, String filePath, DownloadableResource nextResource)
{
return new CharSequenceDownloadableResource(nextResource)
{
protected CharSequence transform(CharSequence originalContent)
{
return "Prefix: " + originalContent;
}
};
}
}
| Modifier | Constructor and Description |
|---|---|
protected |
CharSequenceDownloadableResource(com.atlassian.plugin.servlet.DownloadableResource originalResource) |
| Modifier and Type | Method and Description |
|---|---|
protected Charset |
encoding() |
void |
streamResource(OutputStream out) |
protected abstract CharSequence |
transform(CharSequence original)
Override this method to transform the original content into a new format.
|
getContentType, getOriginalResource, isResourceModified, serveResource, toStringprotected CharSequenceDownloadableResource(com.atlassian.plugin.servlet.DownloadableResource originalResource)
public void streamResource(OutputStream out) throws com.atlassian.plugin.servlet.DownloadException
com.atlassian.plugin.servlet.DownloadExceptionprotected Charset encoding()
protected abstract CharSequence transform(CharSequence original)
original - The content from the original resource.Copyright © 2017 Atlassian. All rights reserved.