Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/util/QueryStringMap.java |
— | — | @@ -26,12 +26,9 @@ |
27 | 27 | |
28 | 28 | import java.io.UnsupportedEncodingException; |
29 | 29 | import java.net.URI; |
30 | | -import java.net.URISyntaxException; |
31 | 30 | import java.net.URLDecoder; |
32 | | -import java.util.Iterator; |
33 | 31 | import java.util.LinkedHashMap; |
34 | 32 | import java.util.Map; |
35 | | -import java.util.Set; |
36 | 33 | import java.util.StringTokenizer; |
37 | 34 | |
38 | 35 | /** |
— | — | @@ -77,43 +74,4 @@ |
78 | 75 | } |
79 | 76 | } |
80 | 77 | |
81 | | - public static void main(String[] args) { |
82 | | - try { |
83 | | - testURI("/x"); |
84 | | - testURI("/x?foo=bar"); |
85 | | - testURI("/x?foo=bar&biz=bax"); |
86 | | - |
87 | | - // The %26 should _not_ split 'foo' from 'bogo' |
88 | | - testURI("/x?foo=bar+%26bogo&next=extreme"); |
89 | | - |
90 | | - // UTF-8 good encoding |
91 | | - testURI("/x?serveuse=%c3%a9nid"); |
92 | | - |
93 | | - // bad encoding; you'll see replacement char |
94 | | - testURI("/x?serveuse=%e9nid"); |
95 | | - |
96 | | - // corner cases; missing params |
97 | | - testURI("/x?foo"); |
98 | | - testURI("/x?foo&bar=baz"); |
99 | | - testURI("/x?foo&&bar"); |
100 | | - testURI("/x?&"); |
101 | | - testURI("/x?="); |
102 | | - testURI("/x?==&"); |
103 | | - |
104 | | - testURI("/updatePage?db=wikilucene&namespace=6&title=Nick+Gorton5+8+05.jpg"); |
105 | | - testURI("/getStatus"); |
106 | | - } catch (URISyntaxException e) { |
107 | | - e.printStackTrace(); |
108 | | - } |
109 | | - } |
110 | | - |
111 | | - private static void testURI(String uri) throws URISyntaxException { |
112 | | - QueryStringMap map = new QueryStringMap(new URI(uri)); |
113 | | - System.out.println(uri); |
114 | | - Set<String> keys = map.keySet(); |
115 | | - for (Iterator<String> i = keys.iterator(); i.hasNext();) { |
116 | | - String key = i.next(); |
117 | | - System.out.println(" \"" + key + "\" => \"" + map.get(key) + "\""); |
118 | | - } |
119 | | - } |
120 | 78 | } |