Package org.ametys.core.cocoon.source
Class ResourceSource
- java.lang.Object
-
- org.apache.excalibur.source.impl.AbstractSource
-
- org.ametys.core.cocoon.source.ResourceSource
-
- All Implemented Interfaces:
Source
public final class ResourceSource extends AbstractSource
Description of a source which is described by the resource protocol which gets a resource from the classloader.
-
-
Constructor Summary
Constructors Constructor Description ResourceSource(String systemId)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()protected voidgetInfos()InputStreamgetInputStream()Return anInputStreamobject to read from the source.URLgetLocation()Get the location of the resourceStringgetMimeType()SourceValiditygetValidity()ReturnsNOPValidity.SHARED_INSTANCEsince a resource doesn't change.-
Methods inherited from class org.apache.excalibur.source.impl.AbstractSource
checkInfos, getContentLength, getLastModified, getScheme, getURI, refresh, setContentLength, setLastModified, setScheme, setSystemId
-
-
-
-
Constructor Detail
-
ResourceSource
public ResourceSource(String systemId) throws MalformedURLException, SourceNotFoundException
Constructor.- Parameters:
systemId- URI of the desired resource- Throws:
MalformedURLException- if the systemId is not like <scheme>://<path>SourceNotFoundException- if the location can not be found in the class loader
-
-
Method Detail
-
exists
public boolean exists()
-
getInfos
protected void getInfos()
- Overrides:
getInfosin classAbstractSource
-
getMimeType
public String getMimeType()
- Specified by:
getMimeTypein interfaceSource- Overrides:
getMimeTypein classAbstractSource
-
getInputStream
public InputStream getInputStream() throws IOException
Return anInputStreamobject to read from the source.- Specified by:
getInputStreamin interfaceSource- Overrides:
getInputStreamin classAbstractSource- Throws:
IOException
-
getValidity
public SourceValidity getValidity()
ReturnsNOPValidity.SHARED_INSTANCEsince a resource doesn't change.- Specified by:
getValidityin interfaceSource- Overrides:
getValidityin classAbstractSource
-
getLocation
public URL getLocation()
Get the location of the resource- Returns:
- The location
-
-