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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns 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.getKey()Get the unique key for this resource, for cache purpose.longGet the resource size, if available.Methods inherited from class org.ametys.core.resources.SimpleResourceHandler
generate, getLastModified, getMimeType, getValidity, service, setupMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.core.resources.ResourceHandler
shouldUseSourceContentLength
-
Constructor Details
-
DefaultResourceHandler
public DefaultResourceHandler()
-
-
Method Details
-
acceptRanges
Description copied from interface:ResourceHandlerReturns true if thisResourceHandlerhandles "Range" requests. false by default.- Returns:
- true if this
ResourceHandlerhandles "Range" requests.
-
getKey
Description copied from interface:ResourceHandlerGet the unique key for this resource, for cache purpose.- Specified by:
getKeyin interfaceResourceHandler- Overrides:
getKeyin classSimpleResourceHandler- Returns:
- The cache key.
-
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
Description copied from interface:ResourceHandlerGet the resource size, if available. -1 if unknown.- Returns:
- The resource size.
-