@@ -0,0 +1,3186 @@
+/*%0A * JBoss, Home of Professional Open Source.%0A * Copyright 2012 Red Hat, Inc., and individual contributors%0A * as indicated by the @author tags.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage io.undertow.server.handlers;%0A%0Aimport io.undertow.server.HttpHandler;%0Aimport io.undertow.server.HttpServerExchange;%0Aimport io.undertow.testutils.AjpIgnore;%0Aimport io.undertow.testutils.DefaultServer;%0Aimport io.undertow.testutils.TestHttpClient;%0Aimport io.undertow.util.HttpString;%0Aimport org.apache.http.Header;%0Aimport org.apache.http.HttpResponse;%0Aimport org.apache.http.client.methods.HttpGet;%0Aimport org.junit.Assert;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0Aimport java.io.IOException;%0Aimport java.net.URLEncoder;%0Aimport java.util.Deque;%0Aimport java.util.Map;%0A%0A/**%0A * @author Stuart Douglas%0A */%0A@RunWith(DefaultServer.class)%0A@AjpIgnore(apacheOnly = true)%0Apublic class LotsOfQueryParametersTestCase %7B%0A%0A    private static final String HEADER = %22HEADER%22;%0A    private static final String MESSAGE = %22Hello Header%22;%0A    private static final int COUNT = 200;%0A%0A    @BeforeClass%0A    public static void setup() %7B%0A        final BlockingHandler blockingHandler = new BlockingHandler();%0A        DefaultServer.setRootHandler(blockingHandler);%0A        blockingHandler.setRootHandler(new HttpHandler() %7B%0A            @Override%0A            public void handleRequest(final HttpServerExchange exchange) %7B%0A                for (Map.Entry%3CString, Deque%3CString%3E%3E entry : exchange.getQueryParameters().entrySet()) %7B%0A                    exchange.getResponseHeaders().put(HttpString.tryFromString(entry.getKey()), entry.getValue().getFirst());%0A                %7D%0A            %7D%0A        %7D);%0A    %7D%0A%0A    @Test%0A    public void testLotsOfQueryParameters() throws IOException %7B%0A        TestHttpClient client = new TestHttpClient();%0A        try %7B%0A            StringBuilder qs = new StringBuilder();%0A            for (int i = 0; i %3C COUNT; ++i) %7B%0A                qs.append(HEADER + i);%0A                qs.append(%22=%22);%0A                qs.append(URLEncoder.encode(MESSAGE + i, %22UTF-8%22));%0A                qs.append(%22&%22);%0A            %7D%0A            HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + %22/path?%22 + qs.toString());%0A            HttpResponse result = client.execute(get);%0A            Assert.assertEquals(200, result.getStatusLine().getStatusCode());%0A            for (int i = 0; i %3C COUNT; ++i) %7B%0A                Header%5B%5D header = result.getHeaders(HEADER + i);%0A                Assert.assertEquals(MESSAGE + i, header%5B0%5D.getValue());%0A            %7D%0A        %7D finally %7B%0A            client.getConnectionManager().shutdown();%0A        %7D%0A    %7D%0A%0A%0A%7D%0A

Add test for lots of query parameters