From: Peter M. <pet...@gm...> - 2008-11-14 07:25:27
|
Hi, I'd like to use the methods like decodeTo in org.mortbay.utl.UrlEncoded to parse HTTP request bodies. These methods currently use the MutliMap add method to append key/value pairs that are found in the body. The problem for me is I need to preserve the order of the parameters as they appear in body. My plan for now is to subclass MultiMap so the add method of my subclass preserves order. This is a bit overkill because my subclass doesn't really need anything more than the add method and some way to get an ArrayList out after the parsing is finished. In an upcoming version of Jetty, would it be possible to make MutliMap implement the following interface package org.mortbay.util; interface Appendable<K> { public void add(K name, Object value); } and then change the methods in UrlEncoded to take Appendable parameters? With this change there would be assurance that my order-preserving container object I send in place of the usual MultiMap will not need all the other methods of a MultiMap instance. Also because the decodeTo methods would take a parameter implementing an interaface, I would no longer need to subclass MultiMap which is really not what I should be doing in this case. I think this is also a nice simplification to the UrlEncoded methods as it makes it clear that they only need the add method of what is now the entire MultiMap object. I hope you find this idea appealing and if I can help make it happen please let me know what I need to do. Thanks, Peter |