public abstract class AbstractResourceReader extends AbstractReader
Modifier and Type | Field and Description |
---|---|
private static Collection<String> |
__ALLOWED_FORMATS |
private static String |
__DEFAULT_FORMAT |
private int |
_cropHeight |
private int |
_cropWidth |
private int |
_height |
private int |
_maxHeight |
private int |
_maxWidth |
private boolean |
_readForDownload |
private int |
_width |
objectModel, out, parameters, resolver, source
Constructor and Description |
---|
AbstractResourceReader() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doSetup(SourceResolver res,
Map objModel,
String src,
Parameters par)
|
void |
generate() |
protected abstract String |
getEncodedFilename()
If needed, returns the resource's name, properly encoded for using in a "Content-Disposition" HTTP header.
May be null, in which case the result of getFilename() is used instead. |
protected abstract String |
getFilename()
Returns the resource's name.
|
protected abstract InputStream |
getInputStream()
Returns the resource's
InputStream . |
protected String |
getKeySuffix()
Helper method to compute a suffix based on resizing and cropping properties.
|
protected abstract long |
getLength()
Returns the resource's length.
|
protected boolean |
processImage()
Determines if the file is an image and should be processed.
|
void |
setup(SourceResolver resolver,
Map objectModel,
String src,
Parameters par) |
getLastModified, getMimeType, recycle, setOutputStream, shouldSetContentLength
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static final String __DEFAULT_FORMAT
private static final Collection<String> __ALLOWED_FORMATS
private int _width
private int _height
private int _maxWidth
private int _maxHeight
private int _cropWidth
private int _cropHeight
private boolean _readForDownload
public AbstractResourceReader()
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException
setup
in interface SitemapModelComponent
setup
in class AbstractReader
ProcessingException
SAXException
IOException
protected abstract void doSetup(SourceResolver res, Map objModel, String src, Parameters par) throws ProcessingException, IOException
setup(SourceResolver, Map, String, Parameters)
. This method should be implemented by subclasses to retrieve the actual resource.res
- the SourceResolver
.objModel
- the Cocoon's object model.src
- the source, as given by the sitemap.par
- the parameters, as given by the sitemap.ProcessingException
- if an error occurs while processing the resource.IOException
- if an error occurs while accessing the resource.public void generate() throws IOException, SAXException, ProcessingException
protected abstract InputStream getInputStream()
InputStream
.InputStream
.protected abstract String getFilename()
protected abstract String getEncodedFilename()
getFilename()
is used instead.protected abstract long getLength()
protected boolean processImage()
true
if file is a imageprotected String getKeySuffix()