Package org.ametys.plugins.core.upload
Class UploadReader
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.reading.AbstractReader
-
- org.ametys.core.util.cocoon.AbstractResourceReader
-
- org.ametys.plugins.core.upload.UploadReader
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Component
,LogEnabled
,Serviceable
,Reader
,SitemapModelComponent
,SitemapOutputComponent
public class UploadReader extends AbstractResourceReader implements Serviceable
Reader
for generating binary output of previously uploaded file.
-
-
Field Summary
Fields Modifier and Type Field Description private CurrentUserProvider
_currentUserProvider
private Upload
_upload
private UploadManager
_uploadManager
-
Fields inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
__ALLOWED_FORMATS, __DEFAULT_FORMAT
-
Fields inherited from class org.apache.cocoon.reading.AbstractReader
objectModel, out, parameters, resolver, source
-
-
Constructor Summary
Constructors Constructor Description UploadReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doSetup(SourceResolver res, Map objModel, String src, Parameters par)
void
generate()
protected 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 ofAbstractResourceReader.getFilename()
is used instead.protected String
getFilename()
Returns the resource's name.protected InputStream
getInputStream()
Returns the resource'sInputStream
.long
getLastModified()
protected long
getLength()
Returns the resource's length.String
getMimeType()
void
recycle()
void
service(ServiceManager serviceManager)
-
Methods inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
generateThumbnail, getKeySuffix, processImage, setup
-
Methods inherited from class org.apache.cocoon.reading.AbstractReader
setOutputStream, shouldSetContentLength
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_currentUserProvider
private CurrentUserProvider _currentUserProvider
-
_uploadManager
private UploadManager _uploadManager
-
-
Constructor Detail
-
UploadReader
public UploadReader()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
doSetup
protected void doSetup(SourceResolver res, Map objModel, String src, Parameters par)
Description copied from class:AbstractResourceReader
Called byAbstractResourceReader.setup(SourceResolver, Map, String, Parameters)
. This method should be implemented by subclasses to retrieve the actual resource.- Specified by:
doSetup
in classAbstractResourceReader
- Parameters:
res
- theSourceResolver
.objModel
- the Cocoon's object model.src
- the source, as given by the sitemap.par
- the parameters, as given by the sitemap.
-
getInputStream
protected InputStream getInputStream()
Description copied from class:AbstractResourceReader
Returns the resource'sInputStream
.- Specified by:
getInputStream
in classAbstractResourceReader
- Returns:
- the resource's
InputStream
.
-
getFilename
protected String getFilename()
Description copied from class:AbstractResourceReader
Returns the resource's name.- Specified by:
getFilename
in classAbstractResourceReader
- Returns:
- the resource's name.
-
getEncodedFilename
protected String getEncodedFilename()
Description copied from class:AbstractResourceReader
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 ofAbstractResourceReader.getFilename()
is used instead.- Specified by:
getEncodedFilename
in classAbstractResourceReader
- Returns:
- the encoded resource's name, if any.
-
getLength
protected long getLength()
Description copied from class:AbstractResourceReader
Returns the resource's length.- Specified by:
getLength
in classAbstractResourceReader
- Returns:
- the resource's length.
-
getLastModified
public long getLastModified()
- Specified by:
getLastModified
in interfaceReader
- Overrides:
getLastModified
in classAbstractReader
-
getMimeType
public String getMimeType()
- Specified by:
getMimeType
in interfaceSitemapOutputComponent
- Overrides:
getMimeType
in classAbstractReader
-
generate
public void generate() throws IOException, SAXException, ProcessingException
- Specified by:
generate
in interfaceReader
- Overrides:
generate
in classAbstractResourceReader
- Throws:
IOException
SAXException
ProcessingException
-
recycle
public void recycle()
- Specified by:
recycle
in interfaceRecyclable
- Overrides:
recycle
in classAbstractReader
-
-