I had been using TOMCAT 6.0.29 but now I have upgraded to 7.0.20. Due to compatibility issues, I had to upgrade Apache Ant as well, from 1.6.0 to 1.8.2.
Now comes the problem. Earlier request.getParameterMap.put() function used to accept java.lang.String,java.lang.String as the parameters but now it is not. I searched on the net and found that it accepts String and a String array as parameters. But since it used to work fine earlier, thus there would have been a workaround which is not present in this upgrade. Can anyone tell me how to make this work.
Thanks in advance,
Post by:Ulf Dittmer
you should not put any values into that Map - those are the request parameters. If you need to store values with the request, use attributes.
The reason this used to work is that JEE 5 (which is what Tomcat 5 supports) did not use a typed Map - so it was a Map<Object,Object>. JEE 6 (which is what Tomcat 7 supports) returns a Map<String,String>, thus relieving the developer from having to cast the values.
Post by:Shishir Verma
"You should not put any values into that Map - those are the request parameters. If you need to store values with the request, use attributes"
Please can you post an example for it.
The command is "request.getParameterMap.put("name",diff.getName());" where getName() returns a String. I type-cast this value to a string array and the compilation passes but the API isn`t functioning properly. Please help how to resolve this issue.
Post by:Bear Bibeault
The fact that you could put values into that Map before is a bug that has been fixed. The Map implementation being used no longer allows puts into the Map.
You'll need to fix the code that relies upon this bug to do things the right way.
Post by:Tim Holloway
, Saloon Keeper
In point of fact, modifying ANY part of an incoming HTTP request in Tomcat is a bad idea. It's a great way to introduce obscure bugs, security holes, and get smacked in the face when you encounter a server that plays games of its own with the request. And the server is entitled to do so, since IT owns the request, not you.