getHttpRequestData().content missing part of second JSON string.
I have a script that received JSON data 99.9% of the time.
The data being sent typically contains 2 JSON log entries(rarely 1 or 3).
The script that takes the JSON post is pretty simple and just writes it to disk and then later on it gets parsed.
Receiver script:
<CFTRY>
<CFIF CGI.CONTENT_TYPE EQ "APPLICATION/JSON">
<CFSET JSON_DATA = DESERIALIZEJSON(TOSTRING(GETHTTPREQUESTDATA().CONTENT))>
<CFFILE
ACTION="WRITE"
FILE="#VARIABLES.USER_INTERACTION_OUTPUT_DIRECTORY#\#VARIABLES.USER_INTERACTION_OUTPUT_FILE#_JSON_RAW.LOG"
OUTPUT="#TOSTRING(GETHTTPREQUESTDATA().CONTENT)#">
</CFIF>
<CFCATCH>
<CFFILE
ACTION="APPEND"
FILE="#VARIABLES.USER_INTERACTION_OUTPUT_DIRECTORY#\ERROR.LOG"
OUTPUT="#VARIABLES.USER_INTERACTION_OUTPUT_FILE#_JSON_RAW.LOG: #CFCATCH.MESSAGE#">
</CFCATCH>
</CFTRY>
The result that is malformed looks like this:
{"call":{"ag...<snip>......ll_complete","version":1}
version":1}
The first long line(abbreviated) is correct JSON data but the second line ONLY contains a snippet from the end of the second packet.
I know that it is not an echo of the first line because sometimes that fragment is long enough to show values that are unique from the first line.
So, why is this happening?
Is there a better way to write the code for the receiver?
Is there a setting in JVM/CF that might make this work right?
Thanks!
