package com.tlswe.awsmock.ec2.servlet;

import java.io.IOException;
import java.util.Map;
import java.util.Set;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tlswe.awsmock.ec2.control.MockEC2QueryHandler;

/**
 * Servlet implementation class AwsMockServlet
 */
public class MockEc2EndpointServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public MockEc2EndpointServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {

        System.out.println("==== New query comming ====");

        Map<String, String[]> queryParams = request.getParameterMap();
        for (Map.Entry<String, String[]> e : (Set<Map.Entry<String, String[]>>) queryParams
                .entrySet()) {
            System.out.println(e.getKey() + " - (" + e.getValue().length + ") - "
                    + e.getValue()[0]);

        }

        response.setContentType("text/xml");
        response.setCharacterEncoding("UTF-8");

        MockEC2QueryHandler.writeReponse(queryParams, response.getWriter());

    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}

@@ -919,16 +919,18 @@
 tion %7B%0A%0A
+//
         
@@ -1025,16 +1025,39 @@
 arams = 
+(Map%3CString, String%5B%5D%3E)
 request.
@@ -1071,24 +1071,26 @@
 meterMap();%0A
+//
         for 
@@ -1169,16 +1169,18 @@
 yParams%0A
+//
         
@@ -1198,24 +1198,26 @@
 trySet()) %7B%0A
+//
             
@@ -1286,16 +1286,18 @@
  %22) - %22%0A
+//
         
@@ -1328,17 +1328,21 @@
 ()%5B0%5D);%0A
-%0A
+//%0A//
         

Remove the debug output of request parameters.