Several CSV, API, HTTP API, and Web interface improvements.

- APIFramework: internal refactoring to consolidate output PrintWriter,
  OutputFormat, and all output flags into SessionConfig
- APIFramework: "HTML" is now a flag, rather than an OutputFormat
- HTTP API: Output format can be select via query parameter in
  addition to HTTP Accept header
- CSV: default output is now without header, to improve roundtripping
- CSV: header can be requested via Accept header or "header" query
  parameter
- Web interface: Added ability to select output format (JSON, CSV or ADM)

Change-Id: I91398bd30dbd6f3b1f69eb51fbf201010d0e5d93
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/242
Reviewed-by: Chris Hillery <ceej@lambda.nu>
Tested-by: Chris Hillery <ceej@lambda.nu>
diff --git a/asterix-app/src/main/resources/webui/querytemplate.html b/asterix-app/src/main/resources/webui/querytemplate.html
index 0adb518..bcd177c 100644
--- a/asterix-app/src/main/resources/webui/querytemplate.html
+++ b/asterix-app/src/main/resources/webui/querytemplate.html
@@ -186,15 +186,23 @@
               <textarea rows="10" id="qry" name="query" class="query" value="%s" placeholder="Type your AQL query ..."></textarea>
             </div>
             
-          <div class="btn-group">
-            <button id="checkboxes-on" class="btn">
-                <i id="opts" class="icon-ok" style="display:none;"></i>Select Options</button>
-            <button id="clear-query-button" class="btn">Clear Query</button>
-            <!-- <button id="checkboxes-off" class="btn">Clear All Options</button> -->
-            <button type="submit" id="run-btn" class="btn btn-custom-darken">Run</button>
-          </div>
+            <div class="btn-group">
+              <button id="checkboxes-on" class="btn">
+                  <i id="opts" class="icon-ok" style="display:none;"></i>Select Options</button>
+              <button id="clear-query-button" class="btn">Clear Query</button>
+              <!-- <button id="checkboxes-off" class="btn">Clear All Options</button> -->
+              <button type="submit" id="run-btn" class="btn btn-custom-darken">Run</button>
+            </div>
 
             <div>
+              <label class="checkbox optlabel"> Output Format:<br/>
+                <select name="output-format" class="btn">
+                  <option selected value="JSON">JSON</option>
+                  <option value="ADM">ADM</option>
+                  <option value="CSV">CSV (no header)</option>
+                  <option value="CSV-Header">CSV (with header)</option>
+                </select>
+              </label>
               <label class="checkbox optlabel"><input type="checkbox" name="print-expr-tree" value="true" /> Print parsed expressions</label>
               <label class="checkbox optlabel"><input type="checkbox" name="print-rewritten-expr-tree" value="true" /> Print rewritten expressions</label>
               <label class="checkbox optlabel"><input type="checkbox" name="print-logical-plan" value="true" /> Print logical plan</label>