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
public class DefaultResourceHandler extends SimpleResourceHandler
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
Constructors Constructor Description DefaultResourceHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptRanges()Returns true if thisResourceHandlerhandles "Range" requests.voidgenerate(OutputStream out, long offset, long length)Generate the resource configured during setup in the context of a range request.longgetLength()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 Detail
-
DefaultResourceHandler
public DefaultResourceHandler()
-
-
Method Detail
-
acceptRanges
public boolean acceptRanges()
Description copied from interface:ResourceHandlerReturns true if thisResourceHandlerhandles "Range" requests. false by default.- Returns:
- true if this
ResourceHandlerhandles "Range" requests.
-
generate
public void generate(OutputStream out, long offset, long length) throws IOException, ProcessingException
Description copied from interface:ResourceHandlerGenerate 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
public long getLength()
Description copied from interface:ResourceHandlerGet the resource size, if available. -1 if unknown.- Returns:
- The resource size.
-
-