public class CharSequenceResource extends BaseDataResource<CharSequence>
IResource
for CharSequences.
The char sequence 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 |
---|
CharSequenceResource(String contentType)
Creates a
CharSequenceResource which will provide its data dynamically with
BaseDataResource.getData(org.apache.wicket.request.resource.IResource.Attributes) |
CharSequenceResource(String contentType,
CharSequence data)
Creates a Resource from the given char sequence with its content type
|
CharSequenceResource(String contentType,
CharSequence data,
String filename)
Creates a Resource from the given char sequence with its content type
|
Modifier and Type | Method and Description |
---|---|
protected Charset |
getCharset() |
protected Long |
getLength(CharSequence data) |
void |
setCharset(Charset charset)
Sets the character set used for reading this resource.
|
protected void |
writeData(Response response,
CharSequence data)
Writes the given data to the response
|
configureResponse, getData, getFilename, newResourceResponse
configureCache, getCachingStrategy, respond, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
public CharSequenceResource(String contentType)
CharSequenceResource
which will provide its data dynamically with
BaseDataResource.getData(org.apache.wicket.request.resource.IResource.Attributes)
contentType
- The Content type of the array.public CharSequenceResource(String contentType, CharSequence data)
contentType
- The Content type of the array.data
- The datapublic CharSequenceResource(String contentType, CharSequence data, String filename)
contentType
- The Content type of the array.data
- The datafilename
- The filename that will be set as the Content-Disposition header.protected void writeData(Response response, CharSequence data)
BaseDataResource
writeData
in class BaseDataResource<CharSequence>
response
- The response to write todata
- The data to writeprotected Long getLength(CharSequence data)
getLength
in class BaseDataResource<CharSequence>
data
- The data to be writtenprotected Charset getCharset()
public void setCharset(Charset charset)
charset
- Charset for componentCopyright © 2006–2022 Apache Software Foundation. All rights reserved.