public class ActionReturn extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ActionReturn.Header |
| Modifier and Type | Field and Description |
|---|---|
String |
encoding
The encoding to use for the output when it is returned
|
List<EntityData> |
entitiesList
A List of entities to return, leave as null if not used
|
EntityData |
entityData
An entity object to return, leave as null if not used
|
String |
format
Indicates the format (from
Formats) to return the entity data in if there is any,
if using an outputstream, use encoding and mimetype |
Map<String,String> |
headers
Optional headers to include in the response (can use the header constants if desired:
ActionReturn.Header),
Example: headers.put(Header.EXPIRES.toString(), "12378389233737"); headers.put("myHeaderKey", "my Value to put in the header"); |
String |
mimeType
The MIME type to use for the output when it is returned
|
OutputStream |
output
the data to output (should use a provided OutputStream), can be binary, leave this null if not used
|
String |
outputString
the output data in string form, leave this null if not used
|
int |
responseCode
The response code to send back from the processing of this action,
the default which also indicates the response code as determined by the system should be used is -1
|
| Constructor and Description |
|---|
ActionReturn(EntityData entityData,
String format)
Create a return that is appropriate for sending back an entity
|
ActionReturn(List<EntityData> entitiesList,
String format)
Create a return that is appropriate for sending back a list of entities
|
ActionReturn(Object data)
Special constructor which will ensure the data is output exactly as is without adding in the entity meta data
|
ActionReturn(Object data,
Map<String,String> headers)
Special constructor which will ensure the data is output exactly as is without adding in the entity meta data
|
ActionReturn(Object data,
Map<String,String> headers,
String format)
Special constructor which will ensure the data is output exactly as is without adding in the entity meta data
|
ActionReturn(OutputStream output)
Set the OutputStream to indicate it was used,
uses default encoding UTF-8 and type of text/xml
|
ActionReturn(String outputString)
Set a string of data to return,
uses default encoding UTF-8 and type of text/xml
|
ActionReturn(String encoding,
String mimeType,
OutputStream output)
Create a return that is appropriate for sending binary data or a large chunk of text
|
ActionReturn(String encoding,
String mimeType,
String outputString)
Create a return that is appropriate for sending back a string
|
| Modifier and Type | Method and Description |
|---|---|
String |
getEncoding() |
List<EntityData> |
getEntitiesList() |
EntityData |
getEntityData() |
String |
getFormat() |
Map<String,String> |
getHeaders() |
String |
getMimeType() |
OutputStream |
getOutput() |
String |
getOutputString() |
int |
getResponseCode() |
void |
setFormat(String format)
Indicates the format (from
Formats) to return the entity data in if there is any,
if using an outputstream, use encoding and mimetype |
void |
setHeaders(Map<String,String> headers)
Set the optional headers to include in the response (can use the header constants if desired:
ActionReturn.Header),
Example: headers.put(Header.EXPIRES.toString(), "12378389233737"); headers.put("myHeaderKey", "my Value to put in the header"); |
void |
setResponseCode(int responseCode) |
String |
toString() |
public String encoding
public String mimeType
public OutputStream output
public String outputString
public EntityData entityData
public List<EntityData> entitiesList
public String format
Formats) to return the entity data in if there is any,
if using an outputstream, use encoding and mimetypepublic Map<String,String> headers
ActionReturn.Header),
Example: public int responseCode
public ActionReturn(OutputStream output)
output - an OutputStream of data to send as ispublic ActionReturn(String outputString)
outputString - a string to send as ispublic ActionReturn(String encoding, String mimeType, OutputStream output)
encoding - the encoding to use for the binary datamimeType - the mime type to use for the binary dataoutput - the stream of binary datapublic ActionReturn(String encoding, String mimeType, String outputString)
encoding - the encoding to use for the binary datamimeType - the mime type to use for the binary dataoutputString - the string valuepublic ActionReturn(Object data)
data - the data to encode (any java objects including collections, POJOs, maps, etc.)public ActionReturn(Object data, Map<String,String> headers)
data - the data to encode (any java objects including collections, POJOs, maps, etc.)headers - (optional) headers to include in the response (can use the header constants if desired: ActionReturn.Header)public ActionReturn(Object data, Map<String,String> headers, String format)
data - the data to encode (any java objects including collections, POJOs, maps, etc.)headers - (optional) headers to include in the response (can use the header constants if desired: ActionReturn.Header)format - (optional) the format to return this data in (from Formats), e.g. Formats.XMLpublic ActionReturn(EntityData entityData, String format)
entityData - an entity object (EntityData object)format - (optional) the format to return this data in (from Formats), e.g. Formats.XMLpublic ActionReturn(List<EntityData> entitiesList, String format)
entityData - a List of entities (EntityData) (can be empty)format - (optional) the format to return this data in (from Formats), e.g. Formats.XMLpublic void setFormat(String format)
Formats) to return the entity data in if there is any,
if using an outputstream, use encoding and mimetypepublic void setHeaders(Map<String,String> headers)
ActionReturn.Header),
Example: public void setResponseCode(int responseCode)
responseCode - the response code to send back from the processing of this action,
the default which also indicates the response code as determined by the system should be used is -1public String getEncoding()
public String getMimeType()
public OutputStream getOutput()
public String getOutputString()
public EntityData getEntityData()
public List<EntityData> getEntitiesList()
public String getFormat()
public int getResponseCode()
Copyright © 2007–2019 Sakai Project. All rights reserved.