0

I have multiple client machines that are processing and sending JSON (Post HTTP) to a central machine. The Central machine is running a Java Servlet and taking the HttpServletRequest variable (request) and doing a request.getReader() and pushing it to a string, which I later parse into a JSON Object.

Before I even get to parse into the JSON Object I sometimes get data corruption from the HttpServletRequest variable, where the JSON string has some previous data from another scanner, seems like the buffer wasn't cleared or something. I did confirm on the client machine that the data being sent out is correct.

  1. Is there anything obvious on Java Servlets with DoPost that I might need to do? I wouldn't think there would be a need for synchronization.
  2. Is there a way to see the full HTTP body within Tomcat without using a sniffer?
pidabrow
  • 966
  • 1
  • 21
  • 47
Matt E
  • 63
  • 1
  • 6
  • 3
    Why don't you post the code instead of explaining what is in it? A line of code is worth a thousand words in this case... By the way, the problem is most likely that you have something in the `static` fields in your Servlet that shouldn't be there. Likely a `Scanner` instance... (which is declared not threadsafe by the API doc) – ppeterka Jan 21 '13 at 09:15
  • 1
    Issue would be more clearer if you could paste your code snippet here – Prateek Sharma Jan 21 '13 at 09:27
  • Related: http://stackoverflow.com/questions/3106452/how-do-servlets-work-instantiation-session-variables-and-multithreading/3106909#3106909 – BalusC Jan 21 '13 at 13:57

0 Answers0