|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.rest.input.RestInputCustomizerImpl
atg.rest.input.JSONInputCustomizer
public class JSONInputCustomizer
This class implements a JSON REST input customizer. A REST input customizer is used to parse data which is sent in a REST request.
RestInputCustomizer| Field Summary | |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
| Fields inherited from class atg.rest.input.RestInputCustomizerImpl |
|---|
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 | |
|---|---|
JSONInputCustomizer()
Constructor |
|
| Method Summary | |
|---|---|
java.util.Map<java.lang.String,java.lang.Object> |
convertToMap(java.lang.Object pObject,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.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,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
Instantiates an object argument from the given JSONObject. |
static org.json.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,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
Returns a JSONObject representing the data from the pData string |
protected java.lang.Object |
processJSONMultiValue(java.lang.Object pObj,
org.json.JSONObject pMultiValueDescriptor,
java.lang.Class<?> pPropType,
java.lang.String pPropName,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
process a json multi value, convert it into a java object |
protected java.lang.Object |
produceMultivalueComponentObject(java.lang.Object pCurrentValue,
org.json.JSONObject pMultiValueDescriptor,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.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 |
| Methods inherited from class atg.rest.input.RestInputCustomizerImpl |
|---|
getAcceptableMimeTypes, getEncoding, getFormat, getInputCustomizer, getInputCustomizer, getMapKeyElementString, getMapValueElementString, javaInstanceForClass, setAcceptableMimeTypes, setEncoding, setFormat, setMapKeyElementString, setMapValueElementString |
| Methods inherited from class atg.nucleus.GenericService |
|---|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService |
| Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
|---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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 JSONInputCustomizer()
| Method Detail |
|---|
public java.lang.Class<?> getContainerClass()
public java.lang.Object parseString(java.lang.String pData,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
throws RestException
pData - a String which contains the data streampRequest - the servlet requestpResponse - the servlet response
RestException - if the string in pData cannot be parsed
public java.util.Map<java.lang.String,java.lang.Object> convertToMap(java.lang.Object pObject,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
throws RestException
pObject - the object to convert, a JSONObjectpRequest - the servlet requestpResponse - the servlet response
RestException - if pObject is not a JSONObject or if an error occurs reading from pObject
public java.lang.Object instantiateObjectParameter(java.lang.Object pJSON,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
throws RestException
pJSON - the JSONObject which contains the data for the object to instantiatepRequest - the servlet requestpResponse - the servlet response
org.json.JSONException - if an exception occurs accessing the JSONObject
RestException - if there is neither an "atg-rest-class-type" property or "class" property or if pJSON is not a JSONObject
protected java.lang.Object processJSONMultiValue(java.lang.Object pObj,
org.json.JSONObject pMultiValueDescriptor,
java.lang.Class<?> pPropType,
java.lang.String pPropName,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
throws java.lang.Exception
pObj - the json objectpMultiValueDescriptor - the type descriptorpPropType - the property type for the objectpPropName - the name of the propertypRequest - the Dynamo requestpResponse - the Dynamo response
java.lang.Exception - if there was an error creating the java multi value object
protected java.lang.Object produceMultivalueComponentObject(java.lang.Object pCurrentValue,
org.json.JSONObject pMultiValueDescriptor,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
throws java.lang.Exception
pCurrentValue - the current json valuepMultiValueDescriptor - the current type descriptorpRequest - the dynamo requestpResponse - the dynamo response
java.lang.Exception - if there was an error producing the java object
public java.lang.String[] splitMultipleStringsAtCharacter(java.lang.String pData,
char pChar)
pData - the string to splitpChar - the character to split at
public static org.json.JSONObject isValidJSONString(java.lang.String pString)
pString - the string to test
public boolean isValidTypeString(java.lang.String pData)
pData - the string to test
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||