Package org.ametys.core.resources
Class DefaultResourceHandler
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.resources.SimpleResourceHandler
org.ametys.core.resources.DefaultResourceHandler
- All Implemented Interfaces:
ResourceHandler
,LogEnabled
,Serviceable
Default resource handler. It accepts range requests and is able to return its length.
-
Field Summary
Fields inherited from class org.ametys.core.resources.SimpleResourceHandler
_objectModel, _parameters, _readForDownload, _requestedLocation, _resolver, _source
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if thisResourceHandler
handles "Range" requests.void
generate
(OutputStream out, long offset, long length) Generate the resource configured during setup in the context of a range request.long
Get the resource size, if available.Methods inherited from class org.ametys.core.resources.SimpleResourceHandler
generate, getKey, getLastModified, getMimeType, getValidity, service, setup
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.core.resources.ResourceHandler
shouldUseSourceContentLength
-
Constructor Details
-
DefaultResourceHandler
public DefaultResourceHandler()
-
-
Method Details
-
acceptRanges
Description copied from interface:ResourceHandler
Returns true if thisResourceHandler
handles "Range" requests. false by default.- Returns:
- true if this
ResourceHandler
handles "Range" requests.
-
generate
public void generate(OutputStream out, long offset, long length) throws IOException, ProcessingException Description copied from interface:ResourceHandler
Generate the resource configured during setup in the context of a range request.- Parameters:
out
- The output stream to write tooffset
- the first byte to sendlength
- the stream length to send- Throws:
IOException
- If an error occursProcessingException
- If an error occurs
-
getLength
Description copied from interface:ResourceHandler
Get the resource size, if available. -1 if unknown.- Returns:
- The resource size.
-