Package org.ametys.core.resources
Interface ResourceHandler
-
- All Known Implementing Classes:
AbstractCompiledResourceHandler
,AbstractResourceHandler
,AbstractSourceMapResourceHandler
,CssResourceHandler
,CSSSourceMapResourceHandler
,DefaultResourceHandler
,ExpiresResourceHandler
,I18nTextResourceHandler
,ImageResourceHandler
,JSResourceHandler
,JSSourceMapResourceHandler
,LessResourceHandler
,MinimizedCSSResourceHandler
,MinimizedJSResourceHandler
,PdfCoverResourceHandler
,SassResourceHandler
,SassSourceMapResourceHandler
,UncompiledSassResourceHandler
,VueJsResourceHandler
public interface ResourceHandler
Interface used to handle resources
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_PRIORITY
Maximum priority.static int
MIN_PRIORITY
Minimum priority.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
generateResource(Source source, OutputStream out, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters)
Generate the resource configured during setup, and output itSerializable
getKey(Source source, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters)
Get the unique key for this resource, for cache purpose.long
getLastModified(Source source, Parameters parameters)
Get the resource last modified timeString
getMimeType(Source source, Parameters parameters)
Return the mime type of the configured resource.int
getPriority()
Get the priority of this handlerlong
getSize(Source source, Parameters parameters)
Get the resource size, if available.SourceValidity
getValidity(Source source, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters)
Get the resource validity, for cache purpose.boolean
isSupported(String src)
Determines if the resource is supported by this handlerSource
setup(String source, Map objectModel, Parameters par, Map<String,Object> additionalParameters)
Initialize the resource handler with a resource.
-
-
-
Field Detail
-
MIN_PRIORITY
static final int MIN_PRIORITY
Minimum priority.- See Also:
- Constant Field Values
-
MAX_PRIORITY
static final int MAX_PRIORITY
Maximum priority.- See Also:
- Constant Field Values
-
-
Method Detail
-
setup
Source setup(String source, Map objectModel, Parameters par, Map<String,Object> additionalParameters) throws IOException, ProcessingException
Initialize the resource handler with a resource.- Parameters:
source
- The source uriobjectModel
- The object modelpar
- The parametersadditionalParameters
- Additional parameters that can be filled, and will be transmitted to getKey, getValidity and generateResource- Returns:
- the resolved source
- Throws:
IOException
- If an error occursProcessingException
- If an error occurs
-
generateResource
void generateResource(Source source, OutputStream out, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters) throws IOException, ProcessingException
Generate the resource configured during setup, and output it- Parameters:
source
- The sourceout
- The output stream to write toobjectModel
- The object modelparameters
- The sitemap parametersadditionalParameters
- Additional parameters- Throws:
IOException
- If an error occursProcessingException
- If an error occurs
-
isSupported
boolean isSupported(String src)
Determines if the resource is supported by this handler- Parameters:
src
- The uri of resource- Returns:
true
if the resource is supported
-
getPriority
int getPriority()
Get the priority of this handler- Returns:
- the priority. The bigger the highest priority
-
getMimeType
String getMimeType(Source source, Parameters parameters)
Return the mime type of the configured resource.- Parameters:
source
- The sourceparameters
- The parameters- Returns:
- The mime type.
-
getKey
Serializable getKey(Source source, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters)
Get the unique key for this resource, for cache purpose.- Parameters:
source
- The sourceobjectModel
- The object modelparameters
- The parametersadditionalParameters
- Additional parameters- Returns:
- The cache key.
-
getValidity
SourceValidity getValidity(Source source, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters)
Get the resource validity, for cache purpose.- Parameters:
source
- The sourceobjectModel
- The object modelparameters
- The parametersadditionalParameters
- Additional parameters- Returns:
- The resource validity.
-
getSize
long getSize(Source source, Parameters parameters)
Get the resource size, if available.- Parameters:
source
- The sourceparameters
- The parameters- Returns:
- The resource size.
-
getLastModified
long getLastModified(Source source, Parameters parameters)
Get the resource last modified time- Parameters:
source
- The sourceparameters
- The parameters- Returns:
- The last modified
-
-