public class JSONOutputCustomizer extends RestOutputCustomizerImpl
RestOutputCustomizer
RestOutputCustomizerImpl.NucleusComponentReferenceObject, RestOutputCustomizerImpl.RepositoryItemReferenceObject
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
REQUEST_SCOPE_PATH, SESSION_SCOPE_PATH, SPACE
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
JSONOutputCustomizer()
Constructor, sets the format to "json"
|
Modifier and Type | Method and Description |
---|---|
protected org.json.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 org.json.JSONArray |
addEnumerationToJSONObject(java.lang.String pResourceName,
java.util.Enumeration<?> pValue,
java.lang.Object pJSON,
java.lang.Object pContainer,
int pNestingDepth,
ParsedURI pParsedURI,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method will add a java.util.Enumeration object to the JSONObject.
|
protected org.json.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 org.json.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 org.json.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 org.json.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 org.json.JSONObject |
getNucleusComponentReferenceObject(GenericService pService,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns a skeleton JSON Object for the given nucleus component
|
protected org.json.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
|
checkAgainstNonExpandableList, createBeanOutput, createBeanValueOutput, createComponentConfiguration, createOutputObject, createOutputObjectNoFiltering, createOutputObjectWithDefaultIncludes, createOutputObjectWithoutDefaultIncludes, enableShowRESTPaths, findComponentConfigJSON, getArrayElementString, getBooleanControlParam, getCollectionElementString, getComponentConfiguration, getComponentConfiguration, getComponentResolver, getContentType, getEncoding, getFilteringManager, getFormat, getHostAndPortString, getIndentSize, getMapElementString, getMapKeyElementString, getMapValueElementString, getNucleusComponentPropertyReferenceString, getNucleusComponentPropertyReferenceString, getNucleusComponentReferenceString, getNucleusComponentReferenceString, getReferenceStringRoot, getRepositoryItemPropertyReferenceString, getRepositoryItemReferenceString, getRootElementString, getStringControlParam, getTimeZoneId, isEnableFormatDateOutput, isEnablePerRequestClassFilters, isEnablePerRequestComponentFilters, isEnablePerRequestFilters, isEnablePerRequestRepositoryFilters, isLoggingPropertyDebug, isObjectANonGenericServiceNucleusComponent, isShowRESTPaths, loadNucleusComponentIntoMap, loadNucleusComponentIntoMap, outputBean, outputBeanProperty, outputBeanValue, outputFilteredProperty, outputNonFilteredProperty, searchComponentConfigs, setArrayElementString, setCollectionElementString, setContentType, setEnableFormatDateOutput, setEnablePerRequestClassFilters, setEnablePerRequestComponentFilters, setEnablePerRequestFilters, setEnablePerRequestRepositoryFilters, setEncoding, setFormat, setIndentSize, setLoggingPropertyDebug, setMapElementString, setMapKeyElementString, setMapValueElementString, setRootElementString, setShowRESTPaths, setTimeZoneId
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService, toString
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public JSONOutputCustomizer()
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 responseRestException
- if a JSONException occursjava.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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamprotected org.json.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, org.json.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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamorg.json.JSONException
- if an error occurs writing to the JSONObjectprotected org.json.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, org.json.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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamorg.json.JSONException
- if an error occurs writing to the JSONObjectprotected org.json.JSONArray addEnumerationToJSONObject(java.lang.String pResourceName, java.util.Enumeration<?> pValue, java.lang.Object pJSON, java.lang.Object pContainer, int pNestingDepth, ParsedURI pParsedURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException, java.io.IOException, org.json.JSONException
pResourceName
- the name of the resourcepValue
- the Enumeration 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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamorg.json.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, org.json.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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamorg.json.JSONException
- if an error occurs writing to the JSONObjectprotected org.json.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, org.json.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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamorg.json.JSONException
- if an error occurs writing to the JSONObjectprotected org.json.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, org.json.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 responseRestException
- if an error occurs processing the REST requestorg.json.JSONException
- if an error occurs writing to the JSONObjectprotected org.json.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, org.json.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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamorg.json.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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing to the output streamprotected org.json.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 responseRestException
- if an exception occurs determining the item descriptor typeprotected org.json.JSONObject getNucleusComponentReferenceObject(GenericService pService, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RestException
pService
- the nucleus component to generate the JSONObject forpRequest
- the servlet requestpResponse
- the servlet responseRestException
- if an exception occurs determining the item descriptor type