|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.rest.output.RestOutputCustomizerImpl atg.rest.output.JSONOutputCustomizer
public class JSONOutputCustomizer
This class implements a JSON REST output customizer.
RestOutputCustomizer
Nested Class Summary |
---|
Nested classes/interfaces inherited from class atg.rest.output.RestOutputCustomizerImpl |
---|
RestOutputCustomizerImpl.NucleusComponentReferenceObject, RestOutputCustomizerImpl.RepositoryItemReferenceObject |
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.rest.output.RestOutputCustomizerImpl |
---|
REQUEST_SCOPE_PATH, SESSION_SCOPE_PATH, SPACE |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
JSONOutputCustomizer()
Constructor, sets the format to "json" |
Method Summary | |
---|---|
protected JSONArray |
addArrayToJSONObject(java.lang.String pResourceName,
java.lang.Object pValue,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add an array to the JSONObject. |
protected JSONArray |
addListToJSONObject(java.lang.String pResourceName,
java.util.List<?> pValue,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add a java.util.List object to the JSONObject. |
protected java.util.Map |
addMapToJSONObject(java.lang.String pResourceName,
java.util.Map<?,?> pValue,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add a java.util.Map object to the JSONObject. |
protected JSONArray |
addObjectArrayToJSONObject(java.lang.String pResourceName,
java.lang.Object[] pValue,
int pIndex,
int pCount,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add an array of Objects to the JSONObject. |
protected void |
addObjectToJSONObject(java.lang.String pResourceName,
java.lang.Object pValue,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add the given object value to the given json object |
protected JSONArray |
addPrimitiveArrayToJSONObject(java.lang.String pResourceName,
java.lang.Object pValue,
int pIndex,
int pCount,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add an array of primitives to the JSONObject. |
protected JSONArray |
addSetToJSONObject(java.lang.String pResourceName,
java.util.Set<?> pValue,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add a java.util.Set object to the JSONObject. |
void |
addValueToOutputObject(java.lang.String pResourceName,
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 JSON Object |
java.lang.Object |
createOutputContainer()
This method creates the output container, a JSONObject. |
protected JSONObject |
getNucleusComponentReferenceObject(GenericService pService,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns a skeleton JSON Object for the given nucleus component |
protected JSONObject |
getRepositoryItemReferenceObject(RepositoryItem pItem,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns a skeleton JSON object for the given repository item |
void |
sendToOutputStream(java.lang.Object pJSON,
DynamoHttpServletResponse pResponse)
Writes the JSONObject to the servlet output stream |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public JSONOutputCustomizer()
Method Detail |
---|
public java.lang.Object createOutputContainer()
public void sendToOutputStream(java.lang.Object pJSON, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException
pJSON
- the JSONObject to writepResponse
- the servlet response
RestException
- if a JSONException occurs
java.io.IOException
- if an input or output stream exception occurspublic void addValueToOutputObject(java.lang.String pResourceName, 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
pResourceName
- the name of the property valuepValue
- the object representing the valuepParsedURI
- an object containing the parsed URIpContainer
- the parent object of the given property namepParent
- the element to add the value to as a text elementpNestingDepth
- the current nesting depth in the object treepRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
java.io.IOException
- if an error occurs writing to the output streamprotected JSONArray addListToJSONObject(java.lang.String pResourceName, java.util.List<?> pValue, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException, JSONException
pResourceName
- the name of the resourcepValue
- the List object to addpJSON
- the JSONObject to populate, if null, no attempt will be made to populate any object
with the resulting JSONArraypContainer
- the parent object of the given property namepNestingDepth
- the current nesting depth in the object treepParsedURI
- an object containing the parsed URIpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
java.io.IOException
- if an error occurs writing to the output stream
JSONException
- if an error occurs writing to the JSONObjectprotected JSONArray addSetToJSONObject(java.lang.String pResourceName, java.util.Set<?> pValue, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException, JSONException
pResourceName
- the name of the resourcepValue
- the Set object to addpJSON
- the JSONObject to populate, if null, no attempt will be made to populate any object
with the resulting JSONArraypContainer
- the parent object of the given property namepNestingDepth
- the current nesting depth in the object treepParsedURI
- an object containing the parsed URIpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
java.io.IOException
- if an error occurs writing to the output stream
JSONException
- if an error occurs writing to the JSONObjectprotected java.util.Map addMapToJSONObject(java.lang.String pResourceName, java.util.Map<?,?> pValue, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException, JSONException
pResourceName
- the name of the resourcepValue
- the Map object to addpJSON
- the JSONObject to populate, if null, no attempt will be made to populate any object
with the resulting JSONObjectpContainer
- the parent object of the given property namepNestingDepth
- the current nesting depth in the object treepParsedURI
- an object containing the parsed URIpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
java.io.IOException
- if an error occurs writing to the output stream
JSONException
- if an error occurs writing to the JSONObjectprotected JSONArray addArrayToJSONObject(java.lang.String pResourceName, java.lang.Object pValue, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException, JSONException
pResourceName
- the name of the resourcepValue
- the array to addpJSON
- the JSONObject to populate, if null, no attempt will be made to populate any object
with the resulting JSONArraypContainer
- the parent object of the given property namepNestingDepth
- the current nesting depth in the object treepParsedURI
- an object containing the parsed URIpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
java.io.IOException
- if an error occurs writing to the output stream
JSONException
- if an error occurs writing to the JSONObjectprotected JSONArray addPrimitiveArrayToJSONObject(java.lang.String pResourceName, java.lang.Object pValue, int pIndex, int pCount, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, JSONException
pResourceName
- the name of the resourcepValue
- the array to addpIndex
- the value from the atg-rest-index parameter or -1 if parameter does not exist in the requestpIndex
- the value from the atg-rest-count parameter or -1 if parameter does not exist in the requestpJSON
- the JSONObject to populate, if null, no attempt will be made to populate any object
with the resulting JSONArraypContainer
- the parent object of the given property namepNestingDepth
- the current nesting depth in the object treepParsedURI
- an object containing the parsed URIpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
JSONException
- if an error occurs writing to the JSONObjectprotected JSONArray addObjectArrayToJSONObject(java.lang.String pResourceName, java.lang.Object[] pValue, int pIndex, int pCount, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException, JSONException
pResourceName
- the name of the resourcepValue
- the array to addpIndex
- the value from the atg-rest-index parameter or -1 if parameter does not exist in the requestpIndex
- the value from the atg-rest-count parameter or -1 if parameter does not exist in the requestpJSON
- the JSONObject to populate, if null, no attempt will be made to populate any object
with the resulting JSONArraypContainer
- the parent object of the given property namepNestingDepth
- the current nesting depth in the object treepParsedURI
- an object containing the parsed URIpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
java.io.IOException
- if an error occurs writing to the output stream
JSONException
- if an error occurs writing to the JSONObjectprotected void addObjectToJSONObject(java.lang.String pResourceName, java.lang.Object pValue, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException
pResourceName
- the name of the resourcepValue
- the object representing the object valuepJSON
- the JSONObject to populatepContainer
- the parent object of the given property namepNestingDepth
- the current nesting depth in the object treepParsedURI
- an object containing the parsed URIpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an error occurs processing the REST request
java.io.IOException
- if an error occurs writing to the output streamprotected JSONObject getRepositoryItemReferenceObject(RepositoryItem pItem, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException
pItem
- the repository item to generate the reference object forpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an exception occurs determining the item descriptor typeprotected JSONObject getNucleusComponentReferenceObject(GenericService pService, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException
pService
- the nucleus component to generate the JSONObject forpRequest
- the servlet requestpResponse
- the servlet response
RestException
- if an exception occurs determining the item descriptor type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |