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.
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.
Joined: Sep 17, 2011
"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.
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.
An IDE is no substitute for an Intelligent Developer.