Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet parameters disappearing

 
Federico Pugnali
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a strange problem regarding my web app. Basically there are a couple of functionalities where I submit a form with GET or POST and sometimes (not always, no pattern found, just submitting a form after calling some js) I don't get the parameters sent at the server. I put a sniffer and checked that the parameters always leave the browser. Then I have a System.out.println at my first filter (in doFilter) of request.getParameterMap.keySet() and when the problem occurs the println shows empty parameters ([]). Somehow the parameters disappear. This happens with the application running on a Tomcat 5.0.28 and also on a Websphere 5. The only clue that I have is that the Velocity pages with the forms where this happens has also previous calls to serverside methods via JSon-RPC. I see the JSon-RPC calls on the sniffer, but I cannot seem to connect them with the problem since there's no exception or error coming from json and since json runs in a different servlet. I really need help on this, any ideas?

Thanks,
Federico
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to debug it, you can compare the code that works versus the code that doesnt work. you might some clue there.

as you mentioned, that it worked some times
 
Federico Pugnali
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean sometimes with the same code (!).
Anyway I've found the problem. I'll try to explain it. The object registered for the JSon-RPC bridge was an inner class. The method accessed via JSon in this inner class then calls a method in its outter class. The outter class has a reference to the last HttpServletRequest. When thru the JSon call any code does a request.getParameter("anything"), although the logic goes ok, the next submit SOMETIMES looses its parameters. I reproduced the bug just with one line (the getparameter one). The failure seems to happen 1 out of 5 or 6 times. When I commented the request.getparameter lines (that has no sense in the JSon calls anyway) the problem didn't appear anymore. So one IF (if(JSonCall)) did the workaround. I still don't know if it's a JSon-RPC-Java bug. I hope my issue helps.

Federico
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for posting back.
Sounds like a hell of a problem to debug.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic