public interface OutputFormattable extends Outputable
OutputableFormatUnsupportedException will pass control over to the internal
handlers for formatting, if you want to stop the request for this format type entirely then
throw an IllegalStateException and the processing will be haltedALL_KNOWN_FORMATS, ATOM, ATOM_EXTENSIONS, ATOM_MIME_TYPE, FORM, FORM_EXTENSIONS, FORM_MIME_TYPE, HTML, HTML_EXTENSIONS, HTML_MIME_TYPE, JSON, JSON_EXTENSIONS, JSON_MIME_TYPE, JSONP, JSONP_EXTENSIONS, JSONP_MIME_TYPE, RSS, RSS_EXTENSIONS, RSS_MIME_TYPE, TXT, TXT_EXTENSIONS, TXT_MIME_TYPE, UTF_8, XML, XML_EXTENSIONS, XML_MIME_TYPE| Modifier and Type | Method and Description |
|---|---|
void |
formatOutput(EntityReference ref,
String format,
List<EntityData> entities,
Map<String,Object> params,
OutputStream output)
Formats the entity or collection included or referred to by this entity ref object
into output according to the format string provided,
Should take into account the reference when determining what the entities are
and how to encode them
NOTE: be careful to correctly handle the list of entities which are meant to be encoded, note that the EntityData objects include meta data and
the data they contain can be of any object type (though all data will come from
your provider so the types should not be surprising) |
getHandledOutputFormatsgetEntityPrefixvoid formatOutput(EntityReference ref, String format, List<EntityData> entities, Map<String,Object> params, OutputStream output)
EntityData objects include meta data and
the data they contain can be of any object type (though all data will come from
your provider so the types should not be surprising)ref - the parsed reference object which uniquely represents this entityformat - a string constant indicating the extension format (from Formats)
for output, (example: Formats.XML)entities - (optional) a list of entity data objects to create formatted output for,
if this is null then the entities should be retrieved based on the reference,
if this contains only a single item AND the ref refers to a single entity
then the entity data object should be extracted from the list and encoded without the indication
that it is a collection, for all other cases the encoding should include an indication that
this is a list of entitiesparams - (optional) incoming set of parameters which may be used to send data specific to this request, may be nulloutput - the output stream to place the formatted data in,
should be UTF-8 encoded if there is char dataFormatUnsupportedException - if you do not handle this format type (passes control to the internal handlers)EntityEncodingException - if you cannot format the entity data for some reasonIllegalArgumentException - if any of the arguments are invalidIllegalStateException - for all other failuresCopyright © 2003–2021 Sakai Project. All rights reserved.