public class JSONInputCustomizer extends RestInputCustomizerImpl
RestInputCustomizer| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
MAP_CLASS |
SPACESERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description |
|---|
JSONInputCustomizer()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.Object> |
convertToMap(java.lang.Object pObject,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Converts the supplied object to a Map of parameters.
|
java.lang.Class<?> |
getContainerClass()
Returns the JSONObject class object, the container used for JSON data.
|
java.lang.Object |
instantiateObjectParameter(java.lang.Object pJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Instantiates an object argument from the given JSONObject.
|
protected boolean |
isMultiValued(java.lang.Class<?> pClass)
Returns true if pClass is a Collection (List or Set) or a Map.
|
static JSONObject |
isValidJSONString(java.lang.String pString)
Returns a JSONObject if the specified string is a valid JSON string, null otherwise
|
boolean |
isValidTypeString(java.lang.String pData)
Returns true if the specified string is a valid JSON string, false otherwise
|
java.lang.Object |
parseString(java.lang.String pData,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns a JSONObject representing the data from the pData string
|
protected java.lang.Object |
processJSONMultiValue(java.lang.Object pObj,
JSONObject pMultiValueDescriptor,
java.lang.Class<?> pPropType,
java.lang.String pPropName,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
process a json multi value, convert it into a java object
|
protected java.lang.Object |
produceMultivalueComponentObject(java.lang.Object pCurrentValue,
JSONObject pMultiValueDescriptor,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
produce a result object for a multivalue component item
|
java.lang.String[] |
splitMultipleStringsAtCharacter(java.lang.String pData,
char pChar)
Splits multiple json strings at the specified character
|
getAcceptableMimeTypes, getEncoding, getFormat, getInputCustomizer, getInputCustomizer, getMapKeyElementString, getMapValueElementString, javaInstanceForClass, setAcceptableMimeTypes, setEncoding, setFormat, setMapKeyElementString, setMapValueElementStringaddLogListener, 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, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic static java.lang.String CLASS_VERSION
public static java.lang.String MAP_CLASS
public java.lang.Class<?> getContainerClass()
public java.lang.Object parseString(java.lang.String pData,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pData - a String which contains the data streampRequest - the servlet requestpResponse - the servlet responseRestException - if the string in pData cannot be parsedpublic java.util.Map<java.lang.String,java.lang.Object> convertToMap(java.lang.Object pObject,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pObject - the object to convert, a JSONObjectpRequest - the servlet requestpResponse - the servlet responseRestException - if pObject is not a JSONObject or if an error occurs reading from pObjectpublic java.lang.Object instantiateObjectParameter(java.lang.Object pJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
{arg1 : {
"atg-rest-class-type":"foo.class.WithNestedMultis",
"atg-rest-class-descriptor": {
"myListOfSets": {
"container-class": "java.util.ArrayList",
"element-class": "java.util.HashSet"
}
},
"myListOfSets": [["red","blue"],["green","yellow"]]
}}
See "Nested Multiple Value Objects in Input" section of ATG Web Services and Integration Framework Guide.pJSON - the JSONObject which contains the data for the object to instantiatepRequest - the servlet requestpResponse - the servlet responseRestException - if there is neither an "atg-rest-class-type" property or "class" property or if pJSON is not a JSONObjectprotected boolean isMultiValued(java.lang.Class<?> pClass)
pClass - The class we are testing to see if it's multi-valued.protected java.lang.Object processJSONMultiValue(java.lang.Object pObj,
JSONObject pMultiValueDescriptor,
java.lang.Class<?> pPropType,
java.lang.String pPropName,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pObj - the json objectpMultiValueDescriptor - the type descriptorpPropType - the property type for the objectpPropName - the name of the propertypRequest - the Dynamo requestpResponse - the Dynamo responsejava.lang.Exception - if there was an error creating the java multi value objectRestExceptionprotected java.lang.Object produceMultivalueComponentObject(java.lang.Object pCurrentValue,
JSONObject pMultiValueDescriptor,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pCurrentValue - the current json valuepMultiValueDescriptor - the current type descriptorpRequest - the dynamo requestpResponse - the dynamo responsejava.lang.Exception - if there was an error producing the java objectRestExceptionpublic java.lang.String[] splitMultipleStringsAtCharacter(java.lang.String pData,
char pChar)
pData - the string to splitpChar - the character to split atpublic static JSONObject isValidJSONString(java.lang.String pString)
pString - the string to testpublic boolean isValidTypeString(java.lang.String pData)
pData - the string to test