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 boolean
exists()
protected void
getInfos()
InputStream
getInputStream()
Return anInputStream
object to read from the source.URL
getLocation()
Get the location of the resourceString
getMimeType()
SourceValidity
getValidity()
ReturnsNOPValidity.SHARED_INSTANCE
since 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:
getInfos
in classAbstractSource
-
getMimeType
public String getMimeType()
- Specified by:
getMimeType
in interfaceSource
- Overrides:
getMimeType
in classAbstractSource
-
getInputStream
public InputStream getInputStream() throws IOException
Return anInputStream
object to read from the source.- Specified by:
getInputStream
in interfaceSource
- Overrides:
getInputStream
in classAbstractSource
- Throws:
IOException
-
getValidity
public SourceValidity getValidity()
ReturnsNOPValidity.SHARED_INSTANCE
since a resource doesn't change.- Specified by:
getValidity
in interfaceSource
- Overrides:
getValidity
in classAbstractSource
-
getLocation
public URL getLocation()
Get the location of the resource- Returns:
- The location
-
-