wicket.resource
Class ByteArrayResource

java.lang.Object
  extended by wicket.Resource
      extended by wicket.markup.html.WebResource
          extended by wicket.resource.ByteArrayResource
All Implemented Interfaces:
java.io.Serializable, IRequestListener, IResourceListener

public class ByteArrayResource
extends WebResource

This class can be used to easy make a Resource from a predefined byte array. If your data comes from a database then a DynamicWebResource is a better choice. Only use this class if you have to have the byte array in memory. Like a pdf that is generated on the fly.

Author:
Johan Compagner
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface wicket.IResourceListener
INTERFACE
 
Constructor Summary
ByteArrayResource(java.lang.String contentType, byte[] array)
          Creates a Resource from the given byte array with its content type
ByteArrayResource(java.lang.String contentType, byte[] array, java.util.Locale locale)
          Creates a Resource from the given byte array with its content type and the locale for which it is valid.
 
Method Summary
 IResourceStream getResourceStream()
           
 
Methods inherited from class wicket.markup.html.WebResource
configureResponse, setHeaders
 
Methods inherited from class wicket.Resource
getParameters, invalidate, isCacheable, onResourceRequested, setCacheable, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayResource

public ByteArrayResource(java.lang.String contentType,
                         byte[] array)
Creates a Resource from the given byte array with its content type

Parameters:
contentType - The Content type of the array.
array - The binary content

ByteArrayResource

public ByteArrayResource(java.lang.String contentType,
                         byte[] array,
                         java.util.Locale locale)
Creates a Resource from the given byte array with its content type and the locale for which it is valid.

Parameters:
contentType - The Content type of the array.
array - The binary content.
locale - The locale of this resource
Method Detail

getResourceStream

public IResourceStream getResourceStream()
Specified by:
getResourceStream in class Resource
Returns:
Gets the resource to render to the requester
See Also:
Resource.getResourceStream()


Copyright © 2004-2007 Wicket developers. All Rights Reserved.