Package org.ametys.core.resources
Class DefaultResourceHandler
- java.lang.Object
- 
- org.ametys.runtime.plugin.component.AbstractLogEnabled
- 
- org.ametys.core.resources.DefaultResourceHandler
 
 
- 
- All Implemented Interfaces:
- ResourceHandler,- LogEnabled,- Serviceable
 - Direct Known Subclasses:
- AbstractCompiledResourceHandler,- AbstractSourceMapResourceHandler,- ExpiresResourceHandler,- I18nTextResourceHandler,- ImageResourceHandler,- MinimizedCSSResourceHandler,- SassSourceMapResourceHandler,- UncompiledSassResourceHandler
 
 public class DefaultResourceHandler extends AbstractLogEnabled implements ResourceHandler, Serviceable Default resource handler
- 
- 
Field SummaryFields Modifier and Type Field Description protected Map_objectModelThe object modelprotected Parameters_parametersThe sitemap parametersprotected boolean_readForDownloadif the resource has been request for downloadprotected String_requestedLocationThe initially requested resource locationprotected SourceResolver_resolverThe source resolverprotected Source_sourceThe resolved source
 - 
Constructor SummaryConstructors Constructor Description DefaultResourceHandler()Default constructor.DefaultResourceHandler(Source source)If theSourceis already resolved by theResourceHandlerProvider, it may provide it through the constructor to avoid resolving it again.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgenerate(OutputStream out)Generate the resource configured during setup, and output itSerializablegetKey()Get the unique key for this resource, for cache purpose.longgetLastModified()Get the resource last modified timelonggetLength()Get the resource size, if available.StringgetMimeType()Return the mime type of the configured resource.SourceValiditygetValidity()Get the resource validity, for cache purpose.voidservice(ServiceManager manager)Sourcesetup(String location, Map objectModel, Parameters parameters, boolean readForDownload)Initialize the resource handler with a resource.- 
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabledgetLogger, setLogger
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.ametys.core.resources.ResourceHandlershouldUseSourceContentLength
 
- 
 
- 
- 
- 
Field Detail- 
_resolverprotected SourceResolver _resolver The source resolver
 - 
_parametersprotected Parameters _parameters The sitemap parameters
 - 
_objectModelprotected Map _objectModel The object model
 - 
_readForDownloadprotected boolean _readForDownload if the resource has been request for download
 - 
_requestedLocationprotected String _requestedLocation The initially requested resource location
 
- 
 - 
Constructor Detail- 
DefaultResourceHandlerpublic DefaultResourceHandler() Default constructor.
 - 
DefaultResourceHandlerpublic DefaultResourceHandler(Source source) If theSourceis already resolved by theResourceHandlerProvider, it may provide it through the constructor to avoid resolving it again.- Parameters:
- source- the source.
 
 
- 
 - 
Method Detail- 
servicepublic void service(ServiceManager manager) throws ServiceException - Specified by:
- servicein interface- Serviceable
- Throws:
- ServiceException
 
 - 
setuppublic Source setup(String location, Map objectModel, Parameters parameters, boolean readForDownload) throws IOException, ProcessingException Description copied from interface:ResourceHandlerInitialize the resource handler with a resource.- Specified by:
- setupin interface- ResourceHandler
- Parameters:
- location- The source uri
- objectModel- The object model
- parameters- The parameters
- readForDownload- if the resource is to be downloaded and not rendered.
- Returns:
- the resolved source
- Throws:
- IOException- If an error occurs
- ProcessingException- If an error occurs
 
 - 
generatepublic void generate(OutputStream out) throws IOException, ProcessingException Description copied from interface:ResourceHandlerGenerate the resource configured during setup, and output it- Specified by:
- generatein interface- ResourceHandler
- Parameters:
- out- The output stream to write to
- Throws:
- IOException- If an error occurs
- ProcessingException- If an error occurs
 
 - 
getKeypublic Serializable getKey() Description copied from interface:ResourceHandlerGet the unique key for this resource, for cache purpose.- Specified by:
- getKeyin interface- ResourceHandler
- Returns:
- The cache key.
 
 - 
getValiditypublic SourceValidity getValidity() Description copied from interface:ResourceHandlerGet the resource validity, for cache purpose.- Specified by:
- getValidityin interface- ResourceHandler
- Returns:
- The resource validity.
 
 - 
getLengthpublic long getLength() Description copied from interface:ResourceHandlerGet the resource size, if available.- Specified by:
- getLengthin interface- ResourceHandler
- Returns:
- The resource size.
 
 - 
getLastModifiedpublic long getLastModified() Description copied from interface:ResourceHandlerGet the resource last modified time- Specified by:
- getLastModifiedin interface- ResourceHandler
- Returns:
- The last modified
 
 - 
getMimeTypepublic String getMimeType() Description copied from interface:ResourceHandlerReturn the mime type of the configured resource.- Specified by:
- getMimeTypein interface- ResourceHandler
- Returns:
- The mime type.
 
 
- 
 
-