public class ByteArrayResource extends BaseDataResource<byte[]>
IResource
for byte arrays. The byte array can be static - passed to the constructor,
or dynamic - by overriding
BaseDataResource.getData(org.apache.wicket.request.resource.IResource.Attributes)
AbstractResource.ContentRangeType, AbstractResource.ResourceResponse, AbstractResource.WriteCallback
IResource.Attributes
CONTENT_DISPOSITION_HEADER_NAME, CONTENT_RANGE_ENDBYTE, CONTENT_RANGE_STARTBYTE, INTERNAL_HEADERS
Constructor and Description |
---|
ByteArrayResource(String contentType)
Creates a
ByteArrayResource which will provide its data dynamically with
BaseDataResource.getData(org.apache.wicket.request.resource.IResource.Attributes) |
ByteArrayResource(String contentType,
byte[] array)
Creates a Resource from the given byte array with its content type
|
ByteArrayResource(String contentType,
byte[] array,
String filename)
Creates a Resource from the given byte array with its content type
|
Modifier and Type | Method and Description |
---|---|
protected Long |
getLength(byte[] data) |
protected void |
writeData(Response response,
byte[] data)
Writes the given data to the response
|
configureResponse, getData, getFilename, newResourceResponse
configureCache, getCachingStrategy, respond, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
public ByteArrayResource(String contentType)
ByteArrayResource
which will provide its data dynamically with
BaseDataResource.getData(org.apache.wicket.request.resource.IResource.Attributes)
contentType
- The Content type of the array.public ByteArrayResource(String contentType, byte[] array)
contentType
- The Content type of the array.array
- The binary contentpublic ByteArrayResource(String contentType, byte[] array, String filename)
contentType
- The Content type of the array.array
- The binary contentfilename
- The filename that will be set as the Content-Disposition header.protected void writeData(Response response, byte[] data)
BaseDataResource
writeData
in class BaseDataResource<byte[]>
response
- The response to write todata
- The data to writeprotected Long getLength(byte[] data)
getLength
in class BaseDataResource<byte[]>
data
- The data to be writtenCopyright © 2006–2022 Apache Software Foundation. All rights reserved.