You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Bastien Duclaux <ba...@ezlogin.com> on 1999/10/28 16:19:44 UTC

mod_jserv/5211: ServletRequest Parameters should be ordered

>Number:         5211
>Category:       mod_jserv
>Synopsis:       ServletRequest Parameters should be ordered
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jserv
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Oct 28 07:20:00 PDT 1999
>Last-Modified:
>Originator:     bastien@ezlogin.com
>Organization:
apache
>Release:        All releases
>Environment:
All environnements (Unix/NT)
>Description:
Parameters names/values are stored in an Hashtable named params inside the JServConnection class.
Some web servers and CGI scripts require parameters to be posted in the same order they appear in the HTML page.
When calling getParametersNames() and getParametersValues(), JServ should return them in the order they appear in the HTML page from which the POST originated.
>How-To-Repeat:
Easy to reproduce:
<form method=POST action=/bin/MyServlet>
<input type=hidden name="param1" value="myvalue1">
<input type=hidden name="param2" value="myvalue2">
... (add as many parameters as you want)
</form>


And in the servlet
Enumeration e=req.getParameterNames()

While (e.hasMoreElements())
 out.println(e.nextElement());

Parameters Names will not be returned in the correct order.
>Fix:
Change the Hashtable where params are stored by an OrderedHashtable. 
Forget about the javax.servlet.HttpUtil class :
postParameters = HttpUtils.parsePostData(getContentLength(), is);

Free implementations of an OrderedHashtable (which should extend Hashtable for compatibility with JSDK) are available on the net.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]