atg.rest.output
Interface RestOutputCustomizer

All Known Implementing Classes:
JSONOutputCustomizer, RestOutputCustomizerImpl, XMLOutputCustomizer

public interface RestOutputCustomizer

An interface to allow for customizing REST output.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Method Summary
 void addValueToOutputObject(java.lang.String pPropertyName, java.lang.Object pValue, ParsedURI pParsedURI, java.lang.Object pContainer, java.lang.Object pParent, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method will add the given value to the Object representing the data that will be output.
 java.lang.Object createBeanOutput(ParsedURI pParsedURI, java.lang.Object pResContainer, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Creates the object representing the output for a bean
 java.lang.Object createBeanValueOutput(ParsedURI pParsedURI, java.lang.String pResourceName, java.lang.Object pValue, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Creates the object representing the output for a property value
 java.lang.Object createOutputContainer()
          This method creates the output container, such as JSONObject or Document.
 java.lang.String getFormat()
          Returns an identifier for the format, like "xml" or "json"
 void outputBean(ParsedURI pParsedURI, java.lang.Object pResContainer, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method outputs all the properties of an object to the response's output stream
 void outputBeanProperty(ParsedURI pParsedURI, java.lang.Object pResContainer, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method outputs a single bean property to the response's output stream by passing it to the output customizer
 void outputBeanValue(ParsedURI pParsedURI, java.lang.String pResourceName, java.lang.Object pValue, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Called to output the property value of a bean property to the output stream for a REST GET request.
 void sendToOutputStream(java.lang.Object pObject, DynamoHttpServletResponse pResponse)
          Writes the output to the servlet output stream
 

Field Detail

CLASS_VERSION

static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Method Detail

getFormat

java.lang.String getFormat()
Returns an identifier for the format, like "xml" or "json"

Returns:
an identifier for the format, like "xml" or "json"

createOutputContainer

java.lang.Object createOutputContainer()
This method creates the output container, such as JSONObject or Document.

Returns:
the output container, such as JSONObject or Document

outputBean

void outputBean(ParsedURI pParsedURI,
                java.lang.Object pResContainer,
                int pNestingDepth,
                DynamoHttpServletRequest pRequest,
                DynamoHttpServletResponse pResponse)
                throws java.io.IOException,
                       RestException
This method outputs all the properties of an object to the response's output stream

Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs

outputBeanProperty

void outputBeanProperty(ParsedURI pParsedURI,
                        java.lang.Object pResContainer,
                        DynamoHttpServletRequest pRequest,
                        DynamoHttpServletResponse pResponse)
                        throws java.io.IOException,
                               RestException
This method outputs a single bean property to the response's output stream by passing it to the output customizer

Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object containing the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs

outputBeanValue

void outputBeanValue(ParsedURI pParsedURI,
                     java.lang.String pResourceName,
                     java.lang.Object pValue,
                     int pNestingDepth,
                     DynamoHttpServletRequest pRequest,
                     DynamoHttpServletResponse pResponse)
                     throws RestException,
                            java.io.IOException
Called to output the property value of a bean property to the output stream for a REST GET request.

Parameters:
pParsedURI - an object containing the ParsedURI
pResourceName - the portion of the URI that is the name of the resource
pValue - the value to output
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs

createBeanOutput

java.lang.Object createBeanOutput(ParsedURI pParsedURI,
                                  java.lang.Object pResContainer,
                                  int pNestingDepth,
                                  DynamoHttpServletRequest pRequest,
                                  DynamoHttpServletResponse pResponse)
                                  throws RestException,
                                         java.io.IOException
Creates the object representing the output for a bean

Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Returns:
an object representing the data to be output
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs

createBeanValueOutput

java.lang.Object createBeanValueOutput(ParsedURI pParsedURI,
                                       java.lang.String pResourceName,
                                       java.lang.Object pValue,
                                       int pNestingDepth,
                                       DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)
                                       throws RestException,
                                              java.io.IOException
Creates the object representing the output for a property value

Parameters:
pParsedURI - an object containing the parsed URI
pResourceName - the name of the resource being output
pValue - the value of the resource
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Returns:
an object representing the data to be output
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs
See Also:
atg.rest.output.RestOutputCustomizer#outputBeanValue(java.lang.String, java.lang.Object, atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)

addValueToOutputObject

void addValueToOutputObject(java.lang.String pPropertyName,
                            java.lang.Object pValue,
                            ParsedURI pParsedURI,
                            java.lang.Object pContainer,
                            java.lang.Object pParent,
                            int pNestingDepth,
                            DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                            throws RestException,
                                   java.io.IOException
This method will add the given value to the Object representing the data that will be output.

Parameters:
pPropertyName - the name of the property value
pValue - the object representing the value
pParsedURI - an object containing the parsed URI
pContainer - the parent container object of the property
pParent - the element to add the value to as a text element
pNestingDepth - the current nesting depth in the object tree
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing to the output stream

sendToOutputStream

void sendToOutputStream(java.lang.Object pObject,
                        DynamoHttpServletResponse pResponse)
                        throws RestException,
                               java.io.IOException
Writes the output to the servlet output stream

Parameters:
pObject - the object representing the data to be written to the output stream
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs