org.wings.externalizer
Interface Externalizer<SUPPORTED_TYPE>

All Known Implementing Classes:
DynamicResourceExternalizer, ImageExternalizer, ImageIconExternalizer, ResourceExternalizer, StaticResourceExternalizer, StringResourceExternalizer, StyleSheetExternalizer, TextExternalizer

public interface Externalizer<SUPPORTED_TYPE>

The ExternalizeManager uses a Externalizer to deliver an external representation of a java object to the output device (usually an HTTP connection). A SFrame'es external representation would be HTML, an Images content the GIF-byte stream, for instance.

An Externalizer must be registered at the ExternalizeManager of the current Session to work seamlessly.

Each Externalizer supports one or more classes it is able to externalize.

Author:
Michael Reinsch, Armin Haaf

Method Summary
 String getExtension(SUPPORTED_TYPE obj)
          Returns the file extension of the given object.
 Collection<HttpHeader> getHeaders(SUPPORTED_TYPE obj)
          Get additional http-headers.
 String getId(SUPPORTED_TYPE obj)
          Suggest an id.
 int getLength(SUPPORTED_TYPE obj)
          Returns the externalized length of this Object.
 String getMimeType(SUPPORTED_TYPE obj)
          returns the mime type of the given object.
 Class[] getSupportedClasses()
          Returns the supported classes.
 String[] getSupportedMimeTypes()
          Returns the supported mime types.
 boolean isFinal(SUPPORTED_TYPE obj)
          Returns true if the object is final, false if transient.
 void write(Object obj, Device out)
          Writes the given object into the given Device.
 

Method Detail

getId

String getId(SUPPORTED_TYPE obj)
Suggest an id. If a resource has a reasonable unique id, then it will be used as the externalized id.


getExtension

String getExtension(SUPPORTED_TYPE obj)
Returns the file extension of the given object. Some (old) browsers use this information instead of the mime type. This is especially necessary if delivering anything different than HTML.


getMimeType

String getMimeType(SUPPORTED_TYPE obj)
returns the mime type of the given object.


getLength

int getLength(SUPPORTED_TYPE obj)
Returns the externalized length of this Object. This value is set as content length in the HttpServletResponse. If it return -1 no content length is set.


isFinal

boolean isFinal(SUPPORTED_TYPE obj)
Returns true if the object is final, false if transient. It is used to control the caching in the browser.


write

void write(Object obj,
           Device out)
           throws IOException,
                  ResourceNotFoundException
Writes the given object into the given Device.

Throws:
ResourceNotFoundException - if the underlying resource is not available.
IOException

getSupportedClasses

Class[] getSupportedClasses()
Returns the supported classes. The ExternalizeManager chooses the Externalizer (if not specified as parameter) by objects class.


getSupportedMimeTypes

String[] getSupportedMimeTypes()
Returns the supported mime types. The ExternalizeManager chooses the Externalizer by mime type (if specified as parameter)


getHeaders

Collection<HttpHeader> getHeaders(SUPPORTED_TYPE obj)
Get additional http-headers. Returns null, if there are no additional headers to be set.

Parameters:
obj - get headers for this object
Returns:
Set of Map.Entry (key-value pairs) or null if none should be added.


wingS Swings ;-)