code: public String getParamstring() {
      StringWriter sw = new StringWriter();
      Enumeration<?> em = req.getParameterNames();
      while (em.hasMoreElements()) {
        String attr = (String) em.nextElement();
        if (attr.equals("method")) continue;
        String value = req.getParameter(attr);
        if (attr.equals("x-requested-with")) continue;
        sw.write(attr);
        sw.write('=');
        sw.write(StringUtil.javaScriptStringEnc(value));
        if (em.hasMoreElements()) sw.write('&');
      }
      return sw.toString();
    }
docs: query string and form control