tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Using ParameterMap throws ClassCastException
Date Tue, 16 Sep 2003 14:23:58 GMT

Howdy,
Terrible idea.  Don't use tomcat internal classes.  Stick to the
interface defined by the spec, whereby
HttpServletRequest#getParameterMap returns an instance java.util.Map.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Morten Andersen [mailto:mortena@mip.sdu.dk]
>Sent: Tuesday, September 16, 2003 10:14 AM
>To: tomcat-user@jakarta.apache.org
>Subject: Using ParameterMap throws ClassCastException
>
>I am using the ParameterMap in request in an authentication mechanism.
>Therefore I need to do the following:
>
>add a mapping of parameters to the request.getParameter(). I do the
>following:
>
>import org.apache.catalina.util.ParameterMap;
>...
>
>           System.out.println("ParameterMap is a: "+
>request.getParameterMap().getClass().getName());
>             try{
>                 ParameterMap map =
>(ParameterMap)request.getParameterMap();
>                 map.setLocked(false);
>                 map.putAll(values.getParameterMap());
>                 map.setLocked(true);
>             }catch(Exception e){
>                 e.printStackTrace();
>             }
>
>This gives the following output:
>ParameterMap is a org.apache.catalina.util.ParameterMap
>And a ClassCastException in this line:
>             ParameterMap map =
(ParameterMap)request.getParameterMap();
>
>So it seems that they reference to two different class-definitions, but
I
>am using the same catalina.jar everywhere. (included it in the
WEB-INF/lib
>dir)
>
>If I put catalina.jar in the WEB-INF/lib dir, then the above error is
>reported, else a ClassNotFoundException is thrown.
>
>I'm using tomcat-4.1 and found the class in the catalina.jar file.
Where
>else is it?
>
>
>Thanks
>
>
>Morten Andersen
>Master of applied mathematics and computer science
>Research assistant (in e-learning)
>
>The Maersk Institute of Production technology at Southern Danish
University
>www.mip.sdu.dk
>Campusvej 55
>DK-5230 Odense M
>Denmark
>+45 6550-3654
>+45 6171-1103
>Jabber id: hat@jabber.dk



This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


Mime
View raw message