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 for
Resource-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected ResourceThe resourceprotected AmetysObjectResolverThe Ametys object resolverprotected RightManagerThe right managerFields inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
__ALLOWED_OUTPUT_FORMATS, __DEFAULT_FORMAT, __UNRESIZABLE_FORMATSFields inherited from class org.apache.cocoon.reading.AbstractReader
objectModel, out, parameters, resolver, source -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCheck the user accessprotected voiddoSetup(SourceResolver res, Map objModel, String src, Parameters par) protected StringIf 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 StringReturns the resource's name.protected InputStreamReturns the resource'sInputStream.getKey()longprotected longReturns the resource's length.voidrecycle()voidservice(ServiceManager sManager) Methods inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
generate, generateThumbnail, getKeySuffix, processImage, setupMethods inherited from class org.apache.cocoon.reading.AbstractReader
setOutputStream, shouldSetContentLengthMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_resolver
The Ametys object resolver -
_object
The resource -
_rightManager
The right manager -
_currentUserProvider
The current user provider
-
-
Constructor Details
-
AmetysResourceReader
public AmetysResourceReader()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
doSetup
protected void doSetup(SourceResolver res, Map objModel, String src, Parameters par) throws ProcessingException, IOException Description copied from class:AbstractResourceReaderCalled byAbstractResourceReader.setup(SourceResolver, Map, String, Parameters). This method should be implemented by subclasses to retrieve the actual resource.- Specified by:
doSetupin 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
Description copied from class:AbstractResourceReaderReturns the resource'sInputStream.- Specified by:
getInputStreamin classAbstractResourceReader- Returns:
- the resource's
InputStream.
-
getFilename
Description copied from class:AbstractResourceReaderReturns the resource's name.- Specified by:
getFilenamein classAbstractResourceReader- Returns:
- the resource's name.
-
getEncodedFilename
Description copied from class:AbstractResourceReaderIf 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:
getEncodedFilenamein classAbstractResourceReader- Returns:
- the encoded resource's name, if any.
-
getLength
Description copied from class:AbstractResourceReaderReturns the resource's length.- Specified by:
getLengthin classAbstractResourceReader- Returns:
- the resource's length.
-
checkUserAccess
Check the user access- Throws:
AuthorizationRequiredException- if authorization is requiredAccessDeniedException- if user has no access
-
getKey
- Specified by:
getKeyin interfaceCacheableProcessingComponent
-
getValidity
- Specified by:
getValidityin interfaceCacheableProcessingComponent
-
getLastModified
- Specified by:
getLastModifiedin interfaceReader- Overrides:
getLastModifiedin classAbstractReader
-
getMimeType
- Specified by:
getMimeTypein interfaceSitemapOutputComponent- Overrides:
getMimeTypein classAbstractReader
-
recycle
- Specified by:
recyclein interfaceRecyclable- Overrides:
recyclein classAbstractReader
-