Class AmetysResourceReader
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.reading.AbstractReader
-
- org.ametys.core.util.cocoon.AbstractResourceReader
-
- org.ametys.plugins.explorer.resources.readers.AmetysResourceReader
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Component
,LogEnabled
,Serviceable
,CacheableProcessingComponent
,Reader
,SitemapModelComponent
,SitemapOutputComponent
public class AmetysResourceReader extends AbstractResourceReader implements Serviceable, CacheableProcessingComponent
Reader forResource
-
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected Resource
_object
The resourceprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected RightManager
_rightManager
The right manager-
Fields inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
__ALLOWED_OUTPUT_FORMATS, __DEFAULT_FORMAT, __UNRESIZABLE_FORMATS
-
Fields inherited from class org.apache.cocoon.reading.AbstractReader
objectModel, out, parameters, resolver, source
-
-
Constructor Summary
Constructors Constructor Description AmetysResourceReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkUserAccess()
Check the user accessprotected void
doSetup(SourceResolver res, Map objModel, String src, Parameters par)
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
.Serializable
getKey()
long
getLastModified()
protected long
getLength()
Returns the resource's length.String
getMimeType()
SourceValidity
getValidity()
void
recycle()
void
service(ServiceManager sManager)
-
Methods inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
generate, 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
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_rightManager
protected RightManager _rightManager
The right manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
-
Constructor Detail
-
AmetysResourceReader
public AmetysResourceReader()
-
-
Method Detail
-
service
public void service(ServiceManager sManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
doSetup
protected void doSetup(SourceResolver res, Map objModel, String src, Parameters par) throws ProcessingException, IOException
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.- Throws:
ProcessingException
- if an error occurs while processing the resource.IOException
- if an error occurs while accessing the resource.
-
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.
-
checkUserAccess
protected void checkUserAccess() throws AuthorizationRequiredException, AccessDeniedException
Check the user access- Throws:
AuthorizationRequiredException
- if authorization is requiredAccessDeniedException
- if user has no access
-
getKey
public Serializable getKey()
- Specified by:
getKey
in interfaceCacheableProcessingComponent
-
getValidity
public SourceValidity getValidity()
- Specified by:
getValidity
in interfaceCacheableProcessingComponent
-
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
-
recycle
public void recycle()
- Specified by:
recycle
in interfaceRecyclable
- Overrides:
recycle
in classAbstractReader
-
-