S
Scott Harper
I have a servlet with a doPost method that grabs the set of posted parameters
with the HttpServletRequest.getParameterMap() method. I want to go through
the list of keys looking for some specific (required) parameters. Once I
process these parameters, I'd like to remove them from the map, leaving a set
of "optional" or unrecognized parameters. Ultimately I will grab them and log
them off as extra data.
However, it appears that because I happen to be running under Tomcat (4.1, if
that really matters), the getParameterMap method actually returns a
org.apache.catalina.utils.ParameterMap object. They have subclassed HashMap
and added some locking capabilities. So I can't use the Map.remove() method
unless I call their setLocked(true) method first.
I'd rather not have my implementation tied specifically to the servlet
container. I've tried copying the ParameterMap object to a more general
purpose map type (HashMap) like:
Map parameterMap = request.getParameterMap();
HashMap h = (HashMap) parameterMap;
But since ParameterMap inherits from HashMap, I suspect I am running into some
"you can't cast up" issues, and I still see the same behavior if I try to call
h.remove().
Does anyone have any suggestions on how to work around this issue?
thanks
scott
with the HttpServletRequest.getParameterMap() method. I want to go through
the list of keys looking for some specific (required) parameters. Once I
process these parameters, I'd like to remove them from the map, leaving a set
of "optional" or unrecognized parameters. Ultimately I will grab them and log
them off as extra data.
However, it appears that because I happen to be running under Tomcat (4.1, if
that really matters), the getParameterMap method actually returns a
org.apache.catalina.utils.ParameterMap object. They have subclassed HashMap
and added some locking capabilities. So I can't use the Map.remove() method
unless I call their setLocked(true) method first.
I'd rather not have my implementation tied specifically to the servlet
container. I've tried copying the ParameterMap object to a more general
purpose map type (HashMap) like:
Map parameterMap = request.getParameterMap();
HashMap h = (HashMap) parameterMap;
But since ParameterMap inherits from HashMap, I suspect I am running into some
"you can't cast up" issues, and I still see the same behavior if I try to call
h.remove().
Does anyone have any suggestions on how to work around this issue?
thanks
scott