org.apache.wicket.request.resource
Class CharSequenceResource

java.lang.Object
  extended by org.apache.wicket.request.resource.AbstractResource
      extended by org.apache.wicket.request.resource.BaseDataResource<CharSequence>
          extended by org.apache.wicket.request.resource.CharSequenceResource
All Implemented Interfaces:
Serializable, IResource, IClusterable

public class CharSequenceResource
extends BaseDataResource<CharSequence>

An 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)

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.AbstractResource
AbstractResource.ResourceResponse, AbstractResource.WriteCallback
 
Nested classes/interfaces inherited from interface org.apache.wicket.request.resource.IResource
IResource.Attributes
 
Field Summary
 
Fields inherited from class org.apache.wicket.request.resource.AbstractResource
INTERNAL_HEADERS
 
Constructor Summary
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
 
Method Summary
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
 
Methods inherited from class org.apache.wicket.request.resource.BaseDataResource
configureResponse, getData, newResourceResponse
 
Methods inherited from class org.apache.wicket.request.resource.AbstractResource
configureCache, flushResponseAfterHeaders, getCachingStrategy, respond, setResponseHeaders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharSequenceResource

public CharSequenceResource(String contentType)
Creates a CharSequenceResource which will provide its data dynamically with BaseDataResource.getData(org.apache.wicket.request.resource.IResource.Attributes)

Parameters:
contentType - The Content type of the array.

CharSequenceResource

public CharSequenceResource(String contentType,
                            CharSequence data)
Creates a Resource from the given char sequence with its content type

Parameters:
contentType - The Content type of the array.
data - The data

CharSequenceResource

public CharSequenceResource(String contentType,
                            CharSequence data,
                            String filename)
Creates a Resource from the given char sequence with its content type

Parameters:
contentType - The Content type of the array.
data - The data
filename - The filename that will be set as the Content-Disposition header.
Method Detail

writeData

protected void writeData(Response response,
                         CharSequence data)
Description copied from class: BaseDataResource
Writes the given data to the response

Specified by:
writeData in class BaseDataResource<CharSequence>
Parameters:
response - The response to write to
data - The data to write

getLength

protected Long getLength(CharSequence data)
Specified by:
getLength in class BaseDataResource<CharSequence>
Parameters:
data - The data to be written
Returns:
The length of the data to be written. Used to set "Content-Length" response header

getCharset

protected Charset getCharset()
Returns:
Charset for resource

setCharset

public void setCharset(Charset charset)
Sets the character set used for reading this resource.

Parameters:
charset - Charset for component


Copyright © 2006–2019 Apache Software Foundation. All rights reserved.